base con autenticacion, registro, modulo encuestas
This commit is contained in:
35
apps/api/src/bootstrap.ts
Normal file
35
apps/api/src/bootstrap.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { swagger } from '@/swagger';
|
||||
import { ValidationPipe } from '@nestjs/common';
|
||||
import { NestExpressApplication } from '@nestjs/platform-express';
|
||||
import { Logger } from 'nestjs-pino';
|
||||
import { envs } from './common/config/envs';
|
||||
|
||||
export const bootstrap = async (app: NestExpressApplication) => {
|
||||
const logger = app.get(Logger);
|
||||
// app.setGlobalPrefix('api');
|
||||
app.useStaticAssets('./uploads', {
|
||||
prefix: '/assets',
|
||||
});
|
||||
app.enableCors({
|
||||
credentials: true,
|
||||
//origin: envs.allow_cors_url,
|
||||
origin: ['*'],
|
||||
methods: ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'],
|
||||
});
|
||||
app.useLogger(logger);
|
||||
app.useGlobalPipes(
|
||||
new ValidationPipe({
|
||||
whitelist: true,
|
||||
forbidNonWhitelisted: true,
|
||||
transform: true,
|
||||
transformOptions: {
|
||||
enableImplicitConversion: true,
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
await swagger(app);
|
||||
await app.listen(envs.port!, () => {
|
||||
logger.log(`This application started at ${envs.host}:${envs.port}`);
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user