-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
47 lines (39 loc) · 1.05 KB
/
server.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
// Import express, made available via NPM.
var express = require('express');
var app = express.createServer();
var PORT = 3000;
// Set the default view engine to EJS.
app.set('view engine', 'ejs');
// Configure the app.
app.configure(function() {
//app.use(express.methodOverride());
//app.use(express.bodyDecoder());
//app.use(app.router);
//app.use(express.staticProvider(__dirname + '/public'));
});
// Development.
app.configure('dev', function() {
app.use(express.errorHandler({dumpExceptions: true, showStack: true}));
});
// Production.
app.configure('prod', function() {
app.use(express.errorHandler());
});
// Route :: /
app.get('/', function(req, res) {
res.render('pages/home', {
locals: {
title: 'Welcome'
}
});
});
// Route :: /pages/hello-world
app.get('/pages/hello-world', function(req, res) {
res.render('pages/hello-world', {
locals: {
title: 'Hello World'
}
});
});
app.listen(PORT);
console.log('Node.js web server listening on port: ' + PORT);