1// 'OPTIONS' is a standard request send by browsers BEFORE your request
2// Your server needs to handle these requests appropriately
3// Please see source and upvote the answer I got this from to share credit
4
5var express = require('express')
6 , cors = require('cors')
7 , app = express();
8const corsOptions = {
9 origin: true,
10 credentials: true
11}
12app.options('*', cors(corsOptions)); // preflight OPTIONS; put before other routes
13app.listen(80, function(){
14 console.log('CORS-enabled web server listening on port 80');
15});