auth checkpoint
auth dependecies not instaled in dev container
This commit is contained in:
1 parent
7378d37b36
commit
42002f8e6f
50 files changed
+3680
-636
No files matched your search
+16
-1
@@ -1,5 +1,7 @@
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { NestFactory, Reflector } from '@nestjs/core';
|
||||
import { ValidationPipe } from '@nestjs/common';
|
||||
import { AppModule } from './app.module';
|
||||
import { JwtAuthPublicGuard } from './modules/auth/jwt-auth-public.guard';
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule);
|
||||
@@ -16,6 +18,19 @@ async function bootstrap() {
|
||||
|
||||
app.setGlobalPrefix('api/v1');
|
||||
|
||||
// Apply global validation pipe
|
||||
app.useGlobalPipes(
|
||||
new ValidationPipe({
|
||||
whitelist: true,
|
||||
transform: true,
|
||||
forbidNonWhitelisted: true,
|
||||
}),
|
||||
);
|
||||
|
||||
// Apply global authentication guard
|
||||
const reflector = app.get(Reflector);
|
||||
app.useGlobalGuards(new JwtAuthPublicGuard(reflector));
|
||||
|
||||
const port = process.env.PORT ?? 3000;
|
||||
const host = '0.0.0.0'; // Bind to all interfaces for Docker
|
||||
await app.listen(port, host);
|
||||
|
||||
Reference in new issue
Block a user