-
Notifications
You must be signed in to change notification settings - Fork 3
/
server.js
40 lines (35 loc) · 1.11 KB
/
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
29
30
31
32
33
34
35
36
37
38
39
40
/*jslint node: true */
var express = require('express'),
_ = require('underscore'),
app = express(),
fs = require('fs'),
server = require('http').createServer(app),
io = require('socket.io').listen(server);
// Configure all the things
app.configure(function() {
app.use(express.methodOverride());
app.use(express.bodyParser());
app.use(app.router);
app.use(express.cookieParser());
app.set('view engine', 'ejs');
app.set('view options', { layout: false });
// Set directories
app.use(express['static']('bower_components'));
app.use(express['static']('lib'));
app.use(express['static']('examples'));
app.use(express['static']('test'));
app.use('/dist', express['static']('dist'));
app.set('views', __dirname);
});
// Require all of the modules in the server directory
fs.readdir('./server', function (err, files) {
_.each(files, function (file) {
require('./server/' + file)(app, io);
});
});
//module.exports = app;
exports = module.exports = server;
// delegates user() function
exports.use = function() {
app.use.apply(app, arguments);
};