feat: add refresh token and global exception filter
This commit is contained in:
+11
-2
@@ -1,6 +1,6 @@
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { AppModule } from './app.module';
|
||||
import { I18nValidationPipe, I18nValidationExceptionFilter } from 'nestjs-i18n';
|
||||
import { I18nValidationExceptionFilter, I18nValidationPipe } from 'nestjs-i18n';
|
||||
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
|
||||
|
||||
async function bootstrap() {
|
||||
@@ -17,7 +17,16 @@ async function bootstrap() {
|
||||
}),
|
||||
);
|
||||
|
||||
app.useGlobalFilters(new I18nValidationExceptionFilter());
|
||||
app.useGlobalFilters(
|
||||
new I18nValidationExceptionFilter({
|
||||
errorFormatter: (errors) => {
|
||||
return errors.map((err) => ({
|
||||
field: err.property,
|
||||
errors: Object.values(err.constraints ?? {}),
|
||||
}));
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
const config = new DocumentBuilder()
|
||||
.setTitle('Borna API')
|
||||
|
||||
Reference in New Issue
Block a user