You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
1.0 KiB
32 lines
1.0 KiB
|
|
var express = require('express');
|
|
var app = express();
|
|
var mt = require('./minetestinfo.js');
|
|
app.get('/get-players', function (req, res) {
|
|
res.setHeader('Content-Type', 'application/json');
|
|
res.send(JSON.stringify(mt.players(true)));
|
|
});
|
|
|
|
var previousAnnounceStr = "none";
|
|
|
|
app.get('/last-announce', function (req, res) {
|
|
res.setHeader('Content-Type', 'text/plain');
|
|
res.send(previousAnnounceStr);
|
|
});
|
|
|
|
app.get('/announce', function (req, res) {
|
|
previousAnnounceStr = JSON.stringify(req.body);
|
|
console.log("announce got:" + previousAnnounceStr);
|
|
res.setHeader('Content-Type', 'text/plain');
|
|
res.send();
|
|
});
|
|
|
|
|
|
var server = app.listen(3000, function () {
|
|
//console.log('express-handlebars example server listening on: 3000');
|
|
var host = server.address().address;
|
|
var port = server.address().port;
|
|
console.log("listserver address:");
|
|
console.log(JSON.stringify(server.address()));
|
|
console.log("(experimental WIP) Minetest master server is listening at http://%s:%s", host, port);
|
|
});
|
|
|