arma-server-web-admin/main.js
2014-04-08 23:49:40 +02:00

32 lines
930 B
JavaScript

var express = require('express'),
Resource = require('express-resource');
var config = require('./config');
var app = express();
app.use(express.logger('dev'));
app.use(express.cookieParser());
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(express.static(__dirname + '/public'));
var servers = require('./routes/servers');
app.resource('api/missions', require('./routes/missions'));
app.resource('api/mods', require('./routes/mods'));
var serversResource = app.resource('api/servers', servers);
app.resource('api/settings', require('./routes/settings'));
var gamespyResource = app.resource('gamespy', require('./routes/servers/gamespy'));
serversResource.add(gamespyResource);
app.get('/api/servers/:server/start', servers.start);
app.get('/api/servers/:server/stop', servers.stop);
app.get('/', function (req, res){
res.sendfile(__dirname + '/public/index.html');
});
app.listen(3000);