-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
51 lines (46 loc) · 1.2 KB
/
index.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
/**
* Module dependencies.
*/
var express = require('express');
var hbs = require('express-hbs');
var format = require('util').format;
var routes = require('./routes');
var config = require('./configuration');
var newrelic = require('./newrelic.js');
var server = express();
/**
* View Configuration.
*/
var hbsconf = {
'partialsDir' : __dirname + '/presentation/views/partials'
};
server.engine('hbs', hbs.express3(hbsconf));
server.set('view engine', 'hbs');
server.set('views', __dirname + '/presentation/views');
/**
* Express Configuration.
*/
if (process.env.PROTOTYPE) {
server.use(express.basicAuth('a', 'b'));
}
if (config.prerender) {
server.use(require('prerender-node').set('prerenderToken', 'IHICuA1WA7Z7emahdIaY'));
}
newrelic.start();
server.set('port', config.port);
server.use(express.static(__dirname + '/presentation/public'));
/**
* Routes Configuration.
*/
routes(server);
/**
* Start Server.
*/
server.listen(server.get('port'), function() {
var msg = '';
msg += '\n- \u001b[31mServeJob - Client - WEB';
msg += '\u001b[31m at \u001b[0m';
msg += 'http://localhost:%s\u001b[0m';
msg = format(msg, server.get('port'));
console.info(msg);
});