2014-02-09 03:19:48 +00:00
|
|
|
var express = require('express'),
|
2014-04-04 08:37:43 +00:00
|
|
|
Resource = require('express-resource');
|
2014-02-09 03:19:48 +00:00
|
|
|
|
2014-04-04 08:37:43 +00:00
|
|
|
var config = require('./config');
|
2014-02-09 03:19:48 +00:00
|
|
|
|
|
|
|
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'));
|
|
|
|
|
2014-04-04 08:37:43 +00:00
|
|
|
app.resource('api/missions', require('./routes/missions'));
|
|
|
|
app.resource('api/mods', require('./routes/mods'));
|
|
|
|
app.resource('api/servers', require('./routes/servers'));
|
|
|
|
app.resource('api/settings', require('./routes/settings'));
|
2014-02-13 22:47:51 +00:00
|
|
|
|
|
|
|
app.get('/api/servers/:id/start', function (req, res){
|
|
|
|
manager.runServer();
|
|
|
|
res.send({status:"ok"});
|
2014-02-09 03:19:48 +00:00
|
|
|
});
|
|
|
|
|
2014-04-04 08:37:43 +00:00
|
|
|
app.get('/', function (req, res){
|
2014-02-09 03:19:48 +00:00
|
|
|
res.sendfile(__dirname + '/public/index.html');
|
|
|
|
});
|
|
|
|
|
|
|
|
app.listen(3000);
|