40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
import { NestFactory } from '@nestjs/core';
|
|
|
|
import { FastifyAdapter, NestFastifyApplication } from '@nestjs/platform-fastify';
|
|
|
|
import * as configs from '@/configs';
|
|
|
|
import { ConfigModule } from './modules/config/config.module';
|
|
|
|
import { forRoot } from './modules/content/content.module';
|
|
import { CreateOptions } from './modules/core/core.types';
|
|
import { DatabaseModule } from './modules/database/database.module';
|
|
import { meiliForRoot } from './modules/meilisearch/melli.module';
|
|
import { JwtAuthGuard } from './modules/user/guards/jwt-auth.guard';
|
|
|
|
export const createOptions: CreateOptions = {
|
|
config: { factories: configs as any, storage: { enabled: true } },
|
|
imports: async (configure) => {
|
|
return [
|
|
ConfigModule.forRoot(configure),
|
|
DatabaseModule.forRoot(configure),
|
|
forRoot(configure),
|
|
meiliForRoot(configure),
|
|
];
|
|
},
|
|
globals: {
|
|
guard: JwtAuthGuard,
|
|
},
|
|
builder: async ({ configure, BootModule }) => {
|
|
const app = await NestFactory.create<NestFastifyApplication>(
|
|
BootModule,
|
|
new FastifyAdapter(),
|
|
{
|
|
cors: true,
|
|
logger: ['error', 'warn'],
|
|
},
|
|
);
|
|
return app;
|
|
},
|
|
};
|