-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
40 lines (34 loc) · 1.33 KB
/
server.js
File metadata and controls
40 lines (34 loc) · 1.33 KB
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
var http = require('http');
var express = require('express');
var mustachex = require('mustachex');
var throttle = require('./lib/throttle');
var db = require('./lib/db');
var app = express();
//throttle.enable();
app.configure(function() {
app.engine('html', mustachex.express);
app.set('view engine', 'html');
app.set('views', __dirname + '/views');
app.use(express.bodyParser({ uploadDir: __dirname + '/uploaded' }));
app.use(express.static(__dirname + '/public'));
app.use(app.router);
});
app.all('*', function(req, res, next) {
if (req.url === '/' || req.url === '/favicon.ico' || req.url === '/renderteams' || req.url.match(/^\/event/g) || req.url.match(/^\/debug/g) || req.url.match(/^\/finish/g)) {
return next();
}
var throttled = throttle.isThrottled(req.connection.remoteAddress);
return throttled ? res.json({ error: 'enhance your calm John Spartan', bannedFor: '1 minute' }) : next();
});
require('./routes/debug')(app);
require('./routes/events')(app);
require('./routes/dashboard')(app);
require('./routes/challenge1')(app);
require('./routes/challenge2')(app);
require('./routes/challenge3')(app);
require('./routes/challenge4')(app);
require('./routes/challenge5')(app);
require('./routes/challenge6')(app);
require('./routes/challenge7')(app);
require('./routes/saboteur')(app);
http.createServer(app).listen(8808);