cupidgpg/src/main.ts

36 lines
753 B
TypeScript
Raw Normal View History

import type {
NestFastifyApplication} from '@nestjs/platform-fastify';
2024-07-27 13:27:38 +02:00
import {
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()