-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
36 lines (31 loc) · 1012 Bytes
/
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
var express = require( "express" ),
http = require( "http" ),
routing = require( "./app/routing" ),
socket = require( "./app/socket" ),
core = require( "./app/core" );
var app = express(),
server = http.createServer( app ),
db = require( "./app/model/bootstrap" );
app.configure( function() {
app.use( "/", express.static( __dirname + "/public" ) );
app.use( express.bodyParser() );
/* TODO: Fix - this will print 500 code reasons to console
app.use( function( req, res, next ) {
var send = res.send;
res.send = function() {
console.log( ">", arguments );
if ( arguments.length == 2 && arguments[ 1 ] == 500 ) {
console.log( "500 code sent:", arguments[ 0 ] );
}
send.call( this, arguments );
}
next.call( this, arguments );
});*/
app.use( app.router );
app.set( "view engine", "jade" );
});
server.listen( 3000 );
core.broadcaster.on( "db:loaded", function() {
routing.init( app, socket );
socket.init( server );
});