-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathapp.js
40 lines (26 loc) · 798 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
38
39
40
'use strict';
var express = require('express');
var app = express();
var populationRouter = require('./src/routes/populationRoutes');
var port = process.env.PORT || 5000;
//used by express first
app.use(express.static('./public'));
app.use(express.static('./src'));
app.use(express.static('./sampledata'));
//templating engine
app.set('views', './src/views');
app.set('view engine', 'ejs');
app.use('/population', populationRouter.getPopulations());
app.get('/', function (req, res) {
res.render('index', {
title: 'Population Chart'
});
});
app.get('/sample', function (req, res) {
res.render('sample', {
title: 'Population Chart using sample tsv file'
});
})
app.listen(port, function () {
console.log('running server on port ' + port)
});