-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
34 lines (29 loc) · 880 Bytes
/
server.js
File metadata and controls
34 lines (29 loc) · 880 Bytes
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
const express = require('express');
const db = require('./models');
const cors = require('cors');
const app = express();
const PORT = 5000;
console.log(process.env);
// body-parser
app.use(cors());
app.use(express.json());
// http://localhost:5000/api/
const apiRouter = require('./serverRoutes/apiRouter');
app.use('/api', apiRouter);
// http://localhost:5000/user/
const userRouter = require('./serverRoutes/userRouter');
app.use('/user', userRouter);
// http://localhost:5000/user/
const itemRouter = require('./serverRoutes/itemRouter');
app.use('/api/item', itemRouter);
// true : DB 초기화
// db.sequelize.sync({ force: true }).then(() => {
// app.listen(PORT, () => {
// console.log(`http://localhost:${PORT}`);
// });
// });
db.sequelize.sync({ force: false }).then(() => {
app.listen(PORT, () => {
console.log(`http://localhost:${PORT}`);
});
});