forked from cs5581/CS684_Project-3-4-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
47 lines (34 loc) · 998 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const express = require('express');
const app=express()
const mysql = require('mysql')
const connection = mysql.createConnection({
host: 'localhost',
user: 'root',
password: 'overalls',
database: 'usersDB'
})
const session = require('express-session');
const bodyParser = require('body-parser');
const passport = require('passport')
const path = require('path');
const port=8001;
const moment = require('moment')
app.locals.moment = moment;
app.use(bodyParser.urlencoded({extended: false}));
app.use(bodyParser.json());
//middleware setup
app.use(session({
secret: 'W$q4=25*8%v-}UV',
resave: true,
saveUninitialized: true
}));
//passport setup
app.use(passport.initialize());
app.use(passport.session());
//setup for static resources
app.use(express.static('public'))
app.set('view engine','ejs')
app.set('views','views')
require('./routes/news')(app, passport);
module.exports=app;
app.listen(port, () => console.log(`Server is running on port ${port}`));