Skip to content

Instantly share code, notes, and snippets.

@jaketrent
Created July 31, 2014 02:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jaketrent/e97358ec750e92bc7795 to your computer and use it in GitHub Desktop.
Save jaketrent/e97358ec750e92bc7795 to your computer and use it in GitHub Desktop.
CORS middleware
app.use(function (req, res, next) {
res.setHeader('Access-Control-Allow-Origin', '*')
res.setHeader('Access-Control-Allow-Methods', 'OPTIONS, GET, POST')
res.setHeader('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept')
next()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment