UNPKG

reclass-doc

Version:

Reclass model documentation generator.

51 lines (50 loc) 1.37 kB
"use strict"; /** * Reclass doc generator * * @author Jiri Hybek <jiri@hybek.cz> * @license Apache-2.0 (c) 2017 Jiri Hybek */ Object.defineProperty(exports, "__esModule", { value: true }); var express = require("express"); /** * Server wrapper class */ var Server = (function () { /** * Server constructor * * @param config Server configuration * @param logger Logger facility */ function Server(config, logger) { var _this = this; /** Last documentation modification time */ this.lastModification = 0; this.port = config.port; this.logger = logger; this.app = express(); this.app.use(express.static(config.outputDir, { index: "index.html" })); this.app.get("/_modified", function (req, res) { res.end(String(_this.lastModification)); }); } /** * Updates modification time */ Server.prototype.setModified = function () { this.lastModification = Date.now(); }; /** * Starts server */ Server.prototype.start = function () { var _this = this; this.logger.info("Starting express server on port " + this.port + "..."); this.app.listen(this.port, function () { _this.logger.info("Started."); }); }; return Server; }()); exports.Server = Server;