forked from robgoon/wikistack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
33 lines (25 loc) · 770 Bytes
/
app.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
const express = require('express');
const server = express();
const morgan = require('morgan');
const bodyParser = require('body-parser');
// const path = require('path');
// const userRouter = require('./routes/user')
const wikiRouter = require('./routes/wiki')
const models = require('./models');
server.use(morgan('dev'));
server.use(express.static(__dirname + '/public'));
server.use(bodyParser.urlencoded({extended: false}));
server.use(bodyParser.json());
// server.use('/user', userRouter);
server.use('/wiki', wikiRouter);
server.get('/', (req, res, next) => {
res.redirect('/wiki');
});
const PORT = 1337;
const init = async () => {
await models.db.sync();
server.listen(PORT, () => {
console.log('Listening on port ' + PORT);
});
}
init();