Skip to content

Instantly share code, notes, and snippets.

@alexandermckay
Created October 19, 2019 10:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexandermckay/781da89b9bb52957504ac6c8e528a0a6 to your computer and use it in GitHub Desktop.
Save alexandermckay/781da89b9bb52957504ac6c8e528a0a6 to your computer and use it in GitHub Desktop.
cors.js
const cors = require('cors');
const corsHandler = cors({ origin: true });
/* Your other code */
const handleEmail = (req, res) => {
corsHandler(req, res, () => {
transporter.sendMail(mailOptions(req.query), transport);
});
res.send({ status: 200 });
};
module.exports = https.onRequest(handleEmail);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment