-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathserver.js
64 lines (46 loc) · 1.51 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//jshint esversion:6
// const express = require("express");
// const app = express();
// const db = require("./models/index");
// const initRoutes = require("./routes/web");
// global.__basedir = __dirname;
// app.use(express.urlencoded({ extended: true }));
// initRoutes(app);
// db.sequelize.sync();
// db.sequelize.sync({ force: true }).then(() => {
// console.log("Drop and re-sync db.");
// });
// let port = 3000;
// app.listen(port, () => {
// console.log(`Running at localhost:${port}`);
// });
// const express = require("express");
// const app = express();
// const db = require("./models/image.model.js");
// const initRoutes = require("./routes/web.js");
// global.__basedir = __dirname;
// app.use(express.urlencoded({ extended: true }));
// initRoutes(app);
// db.sequelize.sync();
// db.sequelize.sync({ force: true }).then(() => {
// console.log("Drop and re-sync db.");
// });
// let port = 3000;
// app.listen(port, () => {
// console.log(`Running at localhost:${port}`);
// });
const express = require("express");
const app = express();
const db = require("./src/models");
const initRoutes = require("./src/routes/web");
global.__basedir = __dirname;
app.use(express.urlencoded({ extended: true }));
initRoutes(app);
// db.sequelize.sync();
db.sequelize.sync({ force: true }).then(() => {
console.log("Drop and re-sync db.");
});
let port = 3000;
app.listen(port, () => {
console.log(`Running at localhost:${port}`);
});