Skip to content

Instantly share code, notes, and snippets.

@agustinfece
Last active June 16, 2021 14:44
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 agustinfece/849b79e6a43fdbbdf0d74301c07b4326 to your computer and use it in GitHub Desktop.
Save agustinfece/849b79e6a43fdbbdf0d74301c07b4326 to your computer and use it in GitHub Desktop.
app.js
import express from 'express';
import sequelize from './utils/database.js';
import router from './routes/routes.js';
const app = express();
app.use(express.urlencoded({ extended: true }));
app.use(express.json());
app.use((_, res, next) => {
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, PATCH, DELETE');
res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization');
next();
});
app.use(router);
sequelize.sync();
app.listen(5000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment