@duongtrungnguyen/nestro
Version:
Service registry for Nest JS
44 lines • 1.76 kB
JavaScript
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __decorateClass = (decorators, target, key, kind) => {
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
for (var i = decorators.length - 1, decorator; i >= 0; i--)
if (decorator = decorators[i])
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
if (kind && result) __defProp(target, key, result);
return result;
};
import { Module } from "@nestjs/common";
import { NestFactory } from "@nestjs/core";
import * as path from "path";
import * as hbs from "hbs";
import { registerHandlebarsHelpers } from "./helpers";
import { ServerModule } from "./server.module";
function wrapModuleWithRegistryServer(AppModule, options) {
let WrappedModule = class {
};
WrappedModule = __decorateClass([
Module({
imports: [ServerModule.register(options), AppModule]
})
], WrappedModule);
return WrappedModule;
}
async function createNestroServer(AppModule, options, applicationOptions) {
const wrappedModule = wrapModuleWithRegistryServer(AppModule, options);
const app = await NestFactory.create(wrappedModule, applicationOptions);
if (options?.enableRegistryDashboard) {
hbs.registerPartials(path.join(__dirname, "..", "..", "resources", "views", "partials"));
app.useStaticAssets(path.join(__dirname, "..", "..", "resources", "static"));
app.setBaseViewsDir(path.join(__dirname, "..", "..", "resources", "views"));
app.setViewEngine("hbs");
app.set("view options", { layout: "layouts/main" });
registerHandlebarsHelpers();
}
app.enableShutdownHooks();
return app;
}
export {
createNestroServer
};
//# sourceMappingURL=bootstrap.js.map