Last active
June 10, 2018 14:17
-
-
Save saigowthamr/a63dfee1f80d9c6ba4722c92209e5c4f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const serverless = require("serverless-http"); | |
| const AWS = require("aws-sdk"); | |
| const express = require("express"); | |
| const cors = require("cors"); | |
| const bodyParser = require("body-parser"); | |
| const app = express(); | |
| if (!AWS.config.region) { | |
| AWS.config.update({ | |
| region: "add your region" //example us-east-1 | |
| }); | |
| } | |
| const ses = new AWS.SES(); | |
| app.use(cors()); | |
| // parse application/x-www-form-urlencoded | |
| app.use(bodyParser.urlencoded({ extended: false })); | |
| // parse application/json | |
| app.use(bodyParser.json()); | |
| app.post("/", (req, res) => { | |
| const name = req.body.name; | |
| const email = req.body.email; | |
| const message = req.body.message; | |
| }); | |
| module.exports.form = serverless(app); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment