Skip to content

Instantly share code, notes, and snippets.

@josiahwiebe
Created September 29, 2016 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josiahwiebe/59313a6d4f91fd8b6f6bbc1ed0233e41 to your computer and use it in GitHub Desktop.
Save josiahwiebe/59313a6d4f91fd8b6f6bbc1ed0233e41 to your computer and use it in GitHub Desktop.
CORS with ExpressJS
app.use((req, res, next) => {
res.header('Access-Control-Allow-Origin', '*')
res.header('Access-Control-Allow-Methods', 'GET,OPTIONS')
res.header('Access-Control-Allow-Headers', 'content-Type, X-Requested-With')
next()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment