From ab8e39387de2ec8d99b1129bbefa6cfcfc4fc1ff Mon Sep 17 00:00:00 2001 From: nhsz Date: Mon, 13 Apr 2020 23:47:58 -0300 Subject: [PATCH] chore: update cors --- cors/utils.js | 4 ++-- routes/index.js | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/cors/utils.js b/cors/utils.js index a38c2e6..1bf1687 100644 --- a/cors/utils.js +++ b/cors/utils.js @@ -1,7 +1,7 @@ -const isDev = process.env.NODE_ENV === 'development'; +// const isDev = process.env.NODE_ENV === 'development'; const CORS_OPTIONS = { - origin: isDev ? '*' : 'https://undefinedschool.io', + origin: '*', optionsSuccessStatus: 200 // some legacy browsers (IE11, various SmartTVs) choke on 204 }; diff --git a/routes/index.js b/routes/index.js index bbd1858..9a238c8 100644 --- a/routes/index.js +++ b/routes/index.js @@ -9,9 +9,12 @@ router.use(cors(CORS_OPTIONS)); router.get('/health', (req, res) => res.sendStatus(200)); -router.post('/payments', (req, res) => { - notifyPayment(req.body); - res.json(req.body); -}); +router + .route('/payments') + .head((req, res) => res.sendStatus(200)) + .post((req, res) => { + notifyPayment(req.body); + res.json(req.body); + }); module.exports = router;