Skip to content

Instantly share code, notes, and snippets.

@saigowthamr
Last active June 10, 2018 14:17
Show Gist options
  • Select an option

  • Save saigowthamr/a63dfee1f80d9c6ba4722c92209e5c4f to your computer and use it in GitHub Desktop.

Select an option

Save saigowthamr/a63dfee1f80d9c6ba4722c92209e5c4f to your computer and use it in GitHub Desktop.
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