-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
60 lines (42 loc) · 1.53 KB
/
Copy pathserver.js
File metadata and controls
60 lines (42 loc) · 1.53 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
var express = require('express');
var app = express();
// set the port of our application
// process.env.PORT lets the port be set by Heroku
var port = process.env.PORT || 8080;
// set the view engine to ejs
app.set('view engine', 'ejs');
// make express look in the public directory for assets (css/js/img)
app.use(express.static(__dirname + '/public'));
// set the home page route
app.get('/', function(req, res) {
// ejs render automatically looks in the views folder
res.render('index');
});
// set the weather page route
app.get('/weather', function(req, res) {
//ejs render automatically looks in the views folder for the weather page
res.render('weather');
});
// set the weather page route
app.get('/billboard', function(req, res) {
//ejs render automatically looks in the views folder for the top Billboard 100 page
res.render('billboard');
});
// set the weather page route
app.get('/blog', function(req, res) {
//ejs render automatically looks in the views folder for the blog page
res.render('blog');
});
// set the weather page route
app.get('/flight', function(req, res) {
//ejs render automatically looks in the views folder for the flight page
res.render('flight');
});
// set the weather page route
app.get('/contact', function(req, res) {
//ejs render automatically looks in the views folder for the contact page
res.render('contact');
});
app.listen(port, function() {
console.log('Our app is running on http://localhost:' + port + ' ' + 'press Ctrl + C, to exit/terminate ');
});