Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

express js cors

//Cors = Cross-origin resource sharing

var express = require('express');
var cors = require('cors');
var app = express();

app.use(cors());

var corsOptions = {
  origin: 'http://example.com',
  optionsSuccessStatus: 200 // some legacy browsers (IE11, various SmartTVs) choke on 204
}

app.listen(80, function () {
  console.log('CORS-enabled web server listening on port 80')
})
Source by expressjs.com #
 
PREVIOUS NEXT
Tagged: #express #js #cors
ADD COMMENT
Topic
Name
8+6 =