Answers for "express getting options instead of post"

0

express getting options instead of post

// 'OPTIONS' is a standard request send by browsers BEFORE your request
// Your server needs to handle these requests appropriately
// Please see source and upvote the answer I got this from to share credit

var express = require('express')
  , cors = require('cors')
  , app = express();
const corsOptions = {
  origin: true,
  credentials: true
}
app.options('*', cors(corsOptions)); // preflight OPTIONS; put before other routes
app.listen(80, function(){
  console.log('CORS-enabled web server listening on port 80');
});
Posted by: Guest on October-26-2020

Code answers related to "express getting options instead of post"

Code answers related to "Javascript"

Browse Popular Code Answers by Language