-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
37 lines (29 loc) · 870 Bytes
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const express = require("express");
const cors = require("cors");
const app = express();
const cookieParser = require('cookie-parser');
const { sequelize } = require("./app/database/db2.js");
require("./app/modelo/relaciones.js");
//uso de cors
app.use(cors());
app.use(cookieParser());
//para los archivos estaticos
app.use(express.static("public"));
//configuracion templates
app.set("view engine", "ejs");
//routes
app.use(require("./app/routes/general_routes.js"));
app.use(require("./app/routes/admin_routes.js"));
app.use(require("./app/routes/compras_routes.js"));
app.use(require("./app/routes/usuarios_routes.js"));
//sequelize
async function sequelize_init(){
try{
await sequelize.sync({force:false})
app.listen(process.env.PORT);
console.log("conectado")
} catch (err){
console.log(err)
}
}
sequelize_init()