Add requiresVersion property to module API.

This commit is contained in:
Michael Teeuw
2016-10-13 16:42:15 +02:00
parent 15a5e3c779
commit 95edbc16bb
8 changed files with 169 additions and 52 deletions

View File

@@ -11,6 +11,7 @@ var server = require("http").Server(app);
var io = require("socket.io")(server);
var path = require("path");
var ipfilter = require("express-ipfilter").IpFilter;
var fs = require("fs");
var Server = function(config, callback) {
console.log("Starting server op port " + config.port + " ... ");
@@ -35,8 +36,15 @@ var Server = function(config, callback) {
app.use("/vendor", express.static(path.resolve(__dirname + "/../vendor")));
app.use("/translations", express.static(path.resolve(__dirname + "/../translations")));
app.get("/version", function(req,res) {
res.send(global.version);
});
app.get("/", function(req, res) {
res.sendFile(path.resolve(__dirname + "/../index.html"));
var html = fs.readFileSync(path.resolve(__dirname + "/../index.html"), {encoding: "utf8"});
html = html.replace("#VERSION#", global.version);
res.send(html);
});
if (typeof callback === "function") {