-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
executable file
·57 lines (45 loc) · 1.46 KB
/
server.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
48
49
50
51
52
53
54
55
56
57
/* eslint-disable prefer-arrow-callback */
const express = require('express');
const morgan = require('morgan');
const methodOverride = require('method-override');
const session = require('express-session');
const passport = require('passport');
require('dotenv').config();
const app = express();
require('./config/database');
require('./config/passport');
const indexRouter = require('./routes/index');
const jobsRouter = require('./routes/jobs');
const feedRouter = require('./routes/feed');
const userRouter = require('./routes/user');
const assessmentsRouter = require('./routes/assessments');
const bootcampRouter = require('./routes/bootcamp');
app.set('view engine', 'ejs');
app.use(morgan('dev'));
app.use(express.static('public'));
app.use(methodOverride('_method'));
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
// eslint-disable-next-line spaced-comment
//may need to delete
// app.use(function(req, res) {
// req.time = new Date().toLocaleTimeString()
// req.date = new Date().toLocaleDateString()
// });
app.use(session({
secret: 'SEIROCKS!',
resave: false,
saveUninitialized: true,
}));
app.use(passport.initialize());
app.use(passport.session());
app.use('/', indexRouter);
app.use('/', jobsRouter);
app.use('/', feedRouter);
app.use('/', userRouter);
app.use('/', assessmentsRouter);
app.use('/', bootcampRouter);
const port = process.env.PORT || 3000;
app.listen(port, () => {
console.log(`Listening on port Andre: ${port}`);
});