-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
49 lines (40 loc) · 1.26 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
41
42
43
44
45
46
47
48
49
const express = require('express');
const expressLayouts = require('express-ejs-layouts');
// const fileUpload = require('express-fileupload');
const session = require('express-session');
const cookieParser = require('cookie-parser');
const flash = require('connect-flash');
const cors = require('cors');
const bodyParser = require('body-parser');
const passport = require('passport');
const jwt = require('jsonwebtoken');
const app = express();
const port = process.env.PORT || 3000;
require('dotenv').config();
app.use(express.urlencoded({ extended: true }));
app.use(express.static('public'));
app.use(expressLayouts);
app.use(cookieParser());
app.use(
session({
secret: 'fdshop',
saveUninitialized: true,
resave: true,
})
);
app.use(flash());
// app.use(fileUpload());
app.set('layout', './layouts/main');
app.set('view engine', 'ejs');
app.use(bodyParser.urlencoded({ extended: true }));
//Landing page
const routes = require('./server/routes/fdRoutes.js');
app.use('/', routes);
app.listen(port, () => console.log(`Listening to port ${port}`));
// body parser configuration
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.use(express.json());
app.use(cors());
app.use(passport.initialize());
app.use(passport.session());