Skip to content

Instantly share code, notes, and snippets.

@oguzcan-yavuz
Created June 3, 2018 13:27
Show Gist options
  • Save oguzcan-yavuz/78bf6e68032cf4355cf0cc94bf144f9a to your computer and use it in GitHub Desktop.
Save oguzcan-yavuz/78bf6e68032cf4355cf0cc94bf144f9a to your computer and use it in GitHub Desktop.
simple cors example
const express = require('express');
const cors = require('cors');
let app = express();
const corsOptions = {
credentials: true,
origin: true,
methods: ['GET', 'HEAD', 'PUT', 'PATCH', 'POST', 'DELETE'],
exposedHeaders: ['x-auth-token']
};
app.use(cors(corsOptions));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment