This repository has been archived by the owner on Feb 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.js
66 lines (54 loc) · 1.58 KB
/
app.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
58
59
60
61
62
63
64
65
66
var express = require('express');
var http = require('http');
var path = require('path');
var app = express();
// all environments
app.set('port', process.env.PORT || 3000);
app.use(express.favicon(__dirname + '/public/images/favicon.ico'));
app.set('views', __dirname + '/views');
app.set('view engine', 'xml');
// development only
if ('development' == app.get('env')) {
app.use(express.logger('dev'));
}
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(express.cookieParser("R+mP2QeS-\"WzN&<mFs]~_V6WMz X[} =<obw<G-"));
app.use(express.session({
key: "sid",
secret: "-b6`_$-+z4nbssRcQhxnv,EFeZvp^-_73TL>3o",
cookie: {
path: '/',
httpOnly: true,
maxAge: 1000 * 60 * 60 * 24 * 30
}
}));
app.use(app.router);
app.use(express.static(path.join(__dirname, 'public')));
app.configure('development', function(){
app.use(express.errorHandler());
app.engine('xml', require('artist').render({
cache: false,
debug: true
}));
});
app.configure('production', function(){
app.engine('xml', require('artist').render({
cache: true,
debug: false
}));
});
var scores = require('./routes/scores');
var routes = require('./routes/index');
app.get('/', routes.index);
app.get('/joystick', routes.joystick);
app.get('/scores', scores.getFull);
app.get('/scores/:id', scores.getOne);
app.post('/scores', scores.post);
app.del('/scores/:id', scores.del);
app.put('/scores/:id', scores.put);
var server = http.createServer(app);
require('./server/server').init(server);
server.listen(app.get('port'), function(){
console.log('Express server listening on port ' + app.get('port'));
});