-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
38 lines (31 loc) · 768 Bytes
/
app.js
File metadata and controls
38 lines (31 loc) · 768 Bytes
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
var express = require('express');
var app = express();
var port = process.env.PORT || 5000;
var bookRouter = express.Router();
app.use(express.static('public'));
app.set('views', './src/views');
app.set('view engine', 'ejs');
bookRouter.route('/')
.get(function(req, res){
res.send('Hello books');
});
bookRouter.route('/single')
.get(function(req, res){
res.send('Hello single book');
});
app.use('/Books', bookRouter);
app.get('/', function(req, res) {
res.render('index', {
title: 'App title goes here',
nav: [{
Link: '/Books',
Text: 'Books'
}, {
Link: '/Authors',
Text: 'Authors'
}]
});
});
app.listen(port, function(err){
console.log('running server on port' + port);
});