-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.js
56 lines (39 loc) · 1.18 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
50
51
52
53
54
55
56
'use strict';
var express = require('express');
var app = express();
var populationRouter = require('./src/routes/populationRoutes');
var authorRouter = require('./src/routes/authorRoutes');
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.use('/booksdata', authorRouter.getAuthors());
app.use('/authors', authorRouter.getAuthors());
app.get('/', function (req, res) {
res.render('index', {
title: 'Population Chart'
});
});
app.get('/books', function (req, res) {
res.render('books', {
title: 'authors Chart'
});
});
app.get('/tsv', function (req, res) {
res.render('authors', {
title: 'authors Chart'
});
});
app.get('/linechart', function (req, res) {
res.render('linechart', {
title: 'authors Chart'
});
})
app.listen(port, function () {
console.log('running server on port ' + port)
});