import * as config from "config"; if (config.get("newrelic.enable")) { require("newrelic"); } import {Server, ServerOptions} from "restify"; import {OptionsBuilder} from "../../src/server/OptionsBuilder"; import {ServerBuilder} from "../../src/server/ServerBuilder"; import {LoggerHelper} from "../../src/helper/logger/LoggerHelper"; import currentRoutes from "./current/Routes"; import stableRoutes from "./stable/Routes"; import {ServerRouterConfig} from "../../src/server/ServerRouterConfig"; let options: ServerOptions = new OptionsBuilder() .withName(config.get("server.options.name")) .withVersion(config.get("server.options.version")) .build(); export let server: Server = new ServerBuilder(new ServerRouterConfig()) .withTimeout(config.get("server.options.timeout")) .withOptions(options) .withRouterList(currentRoutes) .withRouterList(stableRoutes) .withCORS(false) .withMorgan() .withBugsnag() .build(); let port = config.get("port"); server.listen(port, function () { LoggerHelper.getDefaultHandler().info("App online on port: " + port); });