forked from voidlabs/mosaico
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
57 lines (46 loc) · 1.43 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
52
53
54
55
56
57
var express = require('express');
var server = require('./services/app');
var exec = require( "child_process" ).exec;
var cookieParser = require('cookie-parser');
var path = require("path");
server.locals = {
emailTransport: {
// host: 'yoursmtpserver',
// port: 25,
// auth: { user: '####', pass: '####' }
},
emailOptions: {
from: 'Mosaico by VOXmail <[email protected]>', // sender address
// bcc: '[email protected]',
}
};
server.set('port', (process.env.PORT || 5000));
server.use( express.static(__dirname + '/public') );
server.use(cookieParser());
if ( process.argv.indexOf( "--slow" ) !== -1 ) {
console.log("Delaying everything 1 second");
server.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');
require('./services/templatesfilled');
//can-ssr:
server.use( "/", require('./public/ssr') );
server.listen(server.get('port'), function() {
console.log('Node app is running on port', server.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 );
}