-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
32 lines (24 loc) · 990 Bytes
/
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
/*jshint node:true */
var PORT = process.env.PORT || process.argv[2] || 3000,
HOST = process.env.IP;
var http = require('http'),
express = require('express'),
fs = require('fs');
var app = express(),
server = http.createServer(app);
var indexServices = require('./serverFiles/indexServices')();
var gameServices = require('./serverFiles/gameServices')();
app.configure(function () {
app.use(express.logger({format: ":method :status :url"}));
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(app.router);
app.use(express.static(__dirname + "/public"));
app.use(express.errorHandler({dumpExceptions:true, showStack:true}));
});
server.listen(PORT, HOST);
console.log("Server running on " + HOST + ":" + PORT);
// REST Call Routing Registry
app.get('/stopServer', indexServices.stopServer);
app.get('/getScores', gameServices.getScores);
app.post('/saveScores', gameServices.saveScores);