Skip to content

Instantly share code, notes, and snippets.

@josiahwiebe
Created September 29, 2016 15:17
Show Gist options
  • Save josiahwiebe/2185ccaf1381f11195aa816cbb3a0ebd to your computer and use it in GitHub Desktop.
Save josiahwiebe/2185ccaf1381f11195aa816cbb3a0ebd 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