-
-
Save agustinfece/849b79e6a43fdbbdf0d74301c07b4326 to your computer and use it in GitHub Desktop.
app.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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