-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
37 lines (28 loc) · 946 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
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 app = express();
const port = process.env.PORT || 5300;
require('dotenv').config();
app.use(express.urlencoded( { extended: true }));
app.use(express.static('public'));
app.use(expressLayouts);
app.use(cookieParser('CookingBlogSecure'));
app.use(session({
secret: 'CookieBlogSecretSession',
saveUninitialized: true,
resave: true
}));
app.use(flash());
app.use(fileUpload());
app.set('layout', 'layouts/main');
app.set('view engine', 'ejs');
//app.get('/' function(req, res) {
// res.render('home');
//});
const routes = require('./server/routes/recipeRoutes.js');
app.use('/', routes);
app.listen(port, ()=> console.log(`Listening to port ${port}`));