Skip to content

Instantly share code, notes, and snippets.

@CatzillaOrz
Last active November 22, 2017 06:24
Show Gist options
  • Save CatzillaOrz/fd9ef087904ccf02ed7886844ea74949 to your computer and use it in GitHub Desktop.
Save CatzillaOrz/fd9ef087904ccf02ed7886844ea74949 to your computer and use it in GitHub Desktop.
CORS-node
npm install cors --save-dev
var express = require('express')
  , cors = require('cors')
  , app = express();

app.use(cors());

app.get('/products/:id', function(req, res, next){
  res.json({msg: 'This is CORS-enabled for all origins!'});
});

app.listen(80, function(){
  console.log('CORS-enabled web server listening on port 80');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment