-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
25 lines (21 loc) · 793 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
const express = require('express');
const nunjucks = require('nunjucks');
const bodyParser = require('body-parser');
const routes = require('./routes');
const app = express();
//middleware
app.set('view engine', 'html'); // have res.render work with html files
app.engine('html', nunjucks.render); // when giving html files to res.render, tell it to use nunjucks
nunjucks.configure('views', {
noCache: true
}); // point nunjucks to the proper directory for templates
app.use(bodyParser.urlencoded({
extended: true
})); // this is how you call it? // for html forms submit
app.use(bodyParser.json());
app.use(express.static(__dirname + '/public'));
app.use('/', routes);
app.listen(3030, () => console.log('hi'));
// console.log(bodyParser.urlencoded({
// extended: true
// }));