29 lines
638 B
TypeScript
29 lines
638 B
TypeScript
import { FastifyAdapter, NestFastifyApplication } from '@nestjs/platform-fastify';
|
|
import { NestFactory } from '@nestjs/core';
|
|
import handlebars from 'hbs';
|
|
|
|
import { join } from 'path';
|
|
|
|
import { AppModule } from './app.module.js';
|
|
|
|
async function bootstrap() {
|
|
const app = await NestFactory.create<NestFastifyApplication>(AppModule, new FastifyAdapter());
|
|
|
|
const root = import.meta.dirname;
|
|
|
|
app.useStaticAssets({
|
|
root: join(root, '..', 'public'),
|
|
prefix: '/public/'
|
|
});
|
|
|
|
app.setViewEngine({
|
|
engine: {
|
|
handlebars
|
|
},
|
|
templates: join(root, '..', 'views')
|
|
})
|
|
|
|
await app.listen(3000);
|
|
}
|
|
bootstrap();
|