forked from Ynov/ptitspas-ynov-back
edited app module + main
This commit is contained in:
parent
be3cd41521
commit
df4e42ae66
@ -13,6 +13,8 @@ import { APP_FILTER, APP_GUARD, APP_INTERCEPTOR } from '@nestjs/core';
|
|||||||
import { TransformInterceptor } from './common/interceptors/transform.interceptor';
|
import { TransformInterceptor } from './common/interceptors/transform.interceptor';
|
||||||
import { RolesGuard } from './common/guards/roles.guard';
|
import { RolesGuard } from './common/guards/roles.guard';
|
||||||
import { ParentsModule } from './routes/parents/parents.module';
|
import { ParentsModule } from './routes/parents/parents.module';
|
||||||
|
import { JwtModule } from '@nestjs/jwt';
|
||||||
|
import { AuthModule } from './routes/auth/auth.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
@ -27,7 +29,8 @@ import { ParentsModule } from './routes/parents/parents.module';
|
|||||||
validationSchema: configValidationSchema,
|
validationSchema: configValidationSchema,
|
||||||
}),
|
}),
|
||||||
TypeOrmModule.forRootAsync({
|
TypeOrmModule.forRootAsync({
|
||||||
imports: [ConfigModule],
|
imports: [ConfigModule,
|
||||||
|
],
|
||||||
inject: [ConfigService],
|
inject: [ConfigService],
|
||||||
useFactory: (config: ConfigService) => ({
|
useFactory: (config: ConfigService) => ({
|
||||||
type: 'postgres',
|
type: 'postgres',
|
||||||
@ -44,6 +47,7 @@ import { ParentsModule } from './routes/parents/parents.module';
|
|||||||
}),
|
}),
|
||||||
UserModule,
|
UserModule,
|
||||||
ParentsModule,
|
ParentsModule,
|
||||||
|
AuthModule,
|
||||||
],
|
],
|
||||||
controllers: [AppController],
|
controllers: [AppController],
|
||||||
providers: [AppService,
|
providers: [AppService,
|
||||||
|
|||||||
@ -25,12 +25,13 @@ async function bootstrap() {
|
|||||||
|
|
||||||
const reflector = app.get(Reflector);
|
const reflector = app.get(Reflector);
|
||||||
app.useGlobalGuards(
|
app.useGlobalGuards(
|
||||||
new AuthGuard(app.get(JwtService)),
|
new AuthGuard(app.get(JwtService), app.get(Reflector)),
|
||||||
new RolesGuard(reflector)
|
new RolesGuard(app.get(Reflector))
|
||||||
);
|
);
|
||||||
|
|
||||||
await app.listen(port);
|
await app.listen(port);
|
||||||
console.log(`✅ P'titsPas API is running on: ${await app.getUrl()}`);
|
console.log(`✅ P'titsPas API is running on: ${await app.getUrl()}`);
|
||||||
|
console.log(process.env.POSTGRES_DB);
|
||||||
}
|
}
|
||||||
|
|
||||||
bootstrap().catch((err) => {
|
bootstrap().catch((err) => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user