Skip to content

Instantly share code, notes, and snippets.

@rxgx
Last active September 25, 2020 22:16
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 rxgx/59cd3500952a03079de0f008b2655eac to your computer and use it in GitHub Desktop.
Save rxgx/59cd3500952a03079de0f008b2655eac to your computer and use it in GitHub Desktop.
Express initial config
const cors = require('cors');
const express = require('express');
const corsConfig = {
optionsSuccessStatus: 200,
origin: ['http://localhost:3000', 'http://localhost:8000']
}
app = express();
const server = app.listen(3000, () => {
const host = server.address().address;
const port = server.address().port;
console.info('Express now listening on http://%s:%s', host, port);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment