-
Notifications
You must be signed in to change notification settings - Fork 17
/
index.js
44 lines (34 loc) · 1.13 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
var express = require('express');
var app = require('./services/app');
var exec = require( "child_process" ).exec;
var cookieParser = require('cookie-parser');
var path = require("path");
app.set('port', (process.env.PORT || 5000));
app.use( express.static(__dirname + '/public') );
app.use(cookieParser());
if ( process.argv.indexOf( "--slow" ) !== -1 ) {
console.log("Delaying everything 1 second");
app.use( function ( req, res, next ) {
setTimeout(next, 1000);
});
}
require('./services/session');
require('./services/games');
require('./services/players');
require('./services/stats');
require('./services/teams');
require('./services/tournaments');
require('./services/users');
//can-ssr:
app.use( "/", require('./public/service') );
app.listen(app.get('port'), function() {
console.log('Node app is running on port', app.get('port'));
});
if ( process.argv.indexOf( "--develop" ) !== -1 ) {
//is dev mode so do live reload
var child = exec( path.join("node_modules",".bin","steal-tools live-reload"), {
cwd: process.cwd() + "/public"
});
child.stdout.pipe( process.stdout );
child.stderr.pipe( process.stderr );
}