2024-07-27 13:31:25 +02:00
|
|
|
import type {
|
|
|
|
NestFastifyApplication} from '@nestjs/platform-fastify';
|
2024-07-27 13:27:38 +02:00
|
|
|
import {
|
2024-07-27 13:31:25 +02:00
|
|
|
FastifyAdapter
|
2024-07-27 13:27:38 +02:00
|
|
|
} from '@nestjs/platform-fastify'
|
|
|
|
import { NestFactory } from '@nestjs/core'
|
|
|
|
import handlebars from 'hbs'
|
2024-07-27 12:55:13 +02:00
|
|
|
|
2024-07-27 13:27:38 +02:00
|
|
|
import { join } from 'path'
|
2024-07-27 12:55:13 +02:00
|
|
|
|
2024-07-27 13:27:38 +02:00
|
|
|
import { AppModule } from './app.module.js'
|
2024-07-27 12:55:13 +02:00
|
|
|
|
|
|
|
async function bootstrap() {
|
2024-07-27 13:27:38 +02:00
|
|
|
const app = await NestFactory.create<NestFastifyApplication>(
|
|
|
|
AppModule,
|
|
|
|
new FastifyAdapter()
|
|
|
|
)
|
2024-07-27 12:55:13 +02:00
|
|
|
|
2024-07-27 13:27:38 +02:00
|
|
|
const root = import.meta.dirname
|
2024-07-27 12:55:13 +02:00
|
|
|
|
2024-07-27 13:27:38 +02:00
|
|
|
app.useStaticAssets({
|
|
|
|
root: join(root, '..', 'public'),
|
|
|
|
prefix: '/public/',
|
|
|
|
})
|
2024-07-27 12:55:13 +02:00
|
|
|
|
2024-07-27 13:27:38 +02:00
|
|
|
app.setViewEngine({
|
|
|
|
engine: {
|
|
|
|
handlebars,
|
|
|
|
},
|
2024-07-27 15:52:19 +02:00
|
|
|
templates: join(root, '..', 'views.dist'),
|
2024-07-27 13:27:38 +02:00
|
|
|
})
|
2024-07-27 12:55:13 +02:00
|
|
|
|
2024-07-27 13:27:38 +02:00
|
|
|
await app.listen(3000)
|
2024-07-27 12:55:13 +02:00
|
|
|
}
|
2024-07-27 13:27:38 +02:00
|
|
|
bootstrap()
|