-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
33 lines (24 loc) · 1.01 KB
/
app.js
File metadata and controls
33 lines (24 loc) · 1.01 KB
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
const routes = require('./routes');
const twitterBank = require('./twitterBank');
const express = require("express");
const bodyParser = require("body-parser")
const app = express();
const volleyball = require("volleyball");
const nunjucks = require("nunjucks");
// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }));
// parse application/json
app.use(bodyParser.json());
app.use('/', routes);
app.use(volleyball);
app.use(express.static('public'));
app.listen(3000, function() {
console.log('Listening on 3000.');
});
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
const people = [{name: 'Full'}, {name: 'Stacker'}, {name: 'Son'}];
app.get('/:uri', (req, res) => {
res.render( 'index', {title: 'Hall of Fame', people: people} );
});