pinkmine/src/main.ts
2022-11-08 07:44:27 +07:00

30 lines
1.2 KiB
TypeScript

import { NestFactory } from '@nestjs/core';
import { NestExpressApplication } from '@nestjs/platform-express';
import { join } from 'path';
import { AppModule } from './app.module';
import * as hbs from 'hbs';
import configuration from './configs/app';
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = '0';
async function bootstrap() {
const app = await NestFactory.create<NestExpressApplication>(AppModule, {
logger: ['debug', 'error', 'warn', 'log', 'verbose'],
});
app.setBaseViewsDir(join(__dirname, '..', 'views'));
app.setViewEngine('hbs');
// TODO: Продумать как правильно иницировать partial-ы в handlebars
// Возможно подойдёт решение описанное тут - https://www.makeuseof.com/handlebars-nestjs-templating/
// Низкоуровневое решение по исходному коду hbs:
const redminePublicUrl =
configuration().redmineIssueEventEmitterConfig.redmineUrlPublic;
hbs.registerPartial(
'redmineIssueAHref',
`<a href="${redminePublicUrl}/issues/{{issue.id}}">{{issue.tracker.name}} #{{issue.id}}</a>`,
);
await app.listen(process.env['PORT'] || 3000);
}
bootstrap();