-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
47 lines (43 loc) · 1.4 KB
/
index.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
const express = require('express')
const bodyParser = require('body-parser')
const { Model } = require('mongoose')
const session = require('express-session')
const cookieParser = require('cookie-parser')
const path = require('path')
require('./model/db')
require('dotenv').config()
const app = express()
const Login = require('./model/login')
const Question = require('./model/question')
const Answer = require('./model/answer')
const Bookmark = require('./model/bookmark')
const index = require('./routes/index')
const userlogin = require('./routes/userlogin')
const question =require('./routes/question')
const answer = require('./routes/answer')
const sort = require('./routes/sort')
const userlogout= require('./routes/userlogout')
const bookmark = require('./routes/bookmark')
const vote = require('./routes/vote')
const signup = require('./routes/signup')
app.set('views','./views')
app.set('view engine','ejs')
app.use('/js',express.static(__dirname+'/public/js'))
app.use('/css',express.static(__dirname+'/public/css'))
app.use(bodyParser.urlencoded({extended:true}))
app.use(bodyParser.json())
app.use(session({
secret: 'keyboard cat',
resave: false,
saveUninitialized: true
}))
app.use(index)
app.use(userlogin)
app.use(question)
app.use(answer)
app.use(sort)
app.use(userlogout)
app.use(bookmark)
app.use(vote)
app.use(signup)
app.listen(process.env.PORT,()=>console.log('Server running on port 3000'))