-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
40 lines (31 loc) · 1.03 KB
/
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
32
33
34
35
36
37
38
39
40
const express = require('express')
const bodyParser = require('body-parser')
const session = require('express-session')
const cookieparser = require('cookie-parser')
const subscribeRouter = require('./routes/subscribeRouter')
const loginRouter = require('./routes/loginRouter')
const chooseAvatarRouter = require('./routes/chooseAvatarRouter')
const indexRouter = require('./routes/indexRouter')
const playRouter = require('./routes/playRouter')
const logoutRouter = require('./routes/logoutRouter')
const app = express()
//eJS
app.set('views', './views')
app.set('view engine', 'ejs')
app.use(session({
secret: 'Yz2gaP5A4',
resave: true,
saveUninitialized: true
}))
app.use(cookieparser())
//To use post
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({ extended: true }))
app.use('/subscribe', subscribeRouter)
app.use('/login', loginRouter)
app.use('/chooseAvatar', chooseAvatarRouter)
app.use('', indexRouter)
app.use('/play', playRouter)
app.use('/logout', logoutRouter)
app.use(express.static('public'))
app.listen(3000)