UNPKG

kamboja-express

Version:

KambojaJS engine implementation using ExpressJs

52 lines (51 loc) 1.72 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var kamboja_1 = require("kamboja"); var express_engine_1 = require("./express-engine"); var KambojaApplication = (function () { function KambojaApplication(opt) { this.expressEngine = new express_engine_1.ExpressEngine(); this.kamboja = new kamboja_1.Kamboja(this.expressEngine, opt); } KambojaApplication.prototype.set = function (setting, value) { switch (setting) { case "case sensitive routing": case "env": case "etag": case "json replacer": case "json spaces": case "query parser": case "trust proxy": case "views": case "view cache": case "view engine": case "x-powered-by": this.expressEngine.application.set(setting, value); break; default: this.kamboja.set(setting, value); } return this; }; KambojaApplication.prototype.get = function (setting) { return this.kamboja.get(setting); }; KambojaApplication.prototype.apply = function (facility) { this.kamboja.apply(facility); return this; }; KambojaApplication.prototype.use = function (middleware) { if (typeof middleware == "function") { this.expressEngine.application.use(middleware); } else { this.kamboja.use(middleware); } return this; }; KambojaApplication.prototype.init = function () { return this.kamboja.init(); }; return KambojaApplication; }()); exports.KambojaApplication = KambojaApplication;