-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
28 lines (21 loc) · 857 Bytes
/
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
var express = require('express');
var path = require('path');
var app = express();
require('./routes')(app);
// Points Express to a folder where you keep static files
// e.g. css or client side js files
app.use(express.static(path.normalize(__dirname) + '/public'))
// Tell express to use its built in error handler
app.use(express.errorHandler());
app.configure(function() {
app.use(express.logger('dev'));
app.use(express.bodyParser());
});
// These 3 lines tell express taht we are goin to be rendering html files
// held in the public directory which should be in teh sam dir as this file
app.set('views', path.normalize(__dirname) + '/public');
app.set('view engine', 'html');
app.engine('html', require('ejs').renderFile);
var port = Number(process.env.PORT || 8000);
app.listen(port);
console.log("Express server listening to port " + port);