-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathserver.js
67 lines (46 loc) · 1.37 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
58
59
60
61
62
63
64
65
66
67
/*
Name: Amar Panjwani
Title: Review My Project (GA SEI Project 2)
Email: amar.panjwani@gmail.com
Date: 10/1/21
*/
var express = require('express');
var path = require('path');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var session = require('express-session');
var passport = require('passport');
var methodOverride = require('method-override');
require('dotenv').config();
var app = express();
require('./config/database');
require('./config/passport');
var indexRouter = require('./routes/r.index')
var projectsRouter = require('./routes/r.projects')
var feedbacksRouter = require('./routes/r.feedbacks')
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');
app.use(methodOverride('_method'));
app.use(express.static(path.join(__dirname, 'public')));
app.use(logger('dev'));
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
app.use(cookieParser());
app.use(session({
secret: 'SEI Rocks!',
resave: false,
saveUninitialized: true
}));
app.use(passport.initialize());
app.use(passport.session());
app.use(function (req, res, next) {
res.locals.user = req.user;
next();
});
app.use('/', indexRouter);
app.use('/projects', projectsRouter)
app.use('/', feedbacksRouter)
app.use(function(req, res) {
res.status(404).send('Cant find that!');
});
module.exports = app;