From 3be6c99dc371aeea68bfabd8f63b47890719ef9e Mon Sep 17 00:00:00 2001 From: Keith Irwin Date: Wed, 20 Sep 2023 18:21:40 -0600 Subject: [PATCH] fix: :bug: Added CORS for post requests --- index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index c288e3c..9b5cfd5 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,7 @@ 'use strict' require('dotenv').config() const express = require('express') +var cors = require('cors') const app = express() const PORT = process.env.PORT || 8080 @@ -16,7 +17,8 @@ const mailer = require('nodemailer').createTransport({ }, }) -app.use(express.json()).post('/', async (req, res) => { +app.use(express.json()).use(cors()) + .options().post('/', async (req, res) => { // Parse from address let from