Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'nest-raven' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.
this.loggerService.debug('debug');
this.loggerService.info('info');
this.loggerService.silly('silly');
}
@Get('/exception/custom')
public async exceptionCustom() {
throw new UserBlockedException();
}
@Get('/exception/sentry')
public async exceptionSentry() {
throw new HttpException('Should be cached by sentry', HttpStatus.INTERNAL_SERVER_ERROR);
}
@UseInterceptors(RavenInterceptor({
filters: [
{ type: HttpException, filter: (exception: HttpException) => 500 > exception.getStatus() },
],
tags: {
tryingOut: 'ravenInterceptor',
},
level: 'warning',
}))
@Get('/exception/http')
public async exceptionHttp() {
throw new Error('some error');
// throw new BadRequestException({ message: 'this should be', with: ['an', 'array'] });
}
@Post('/upload')
@UseInterceptors(StorageInterceptor('file', STORAGE_TYPE.DISK))
AuthenticationModule, // Required for AuthMiddleware
// Init TypeOrm
TypeOrmModule.forRoot(),
// Init Router
RouterModule.forRoutes(appRoutes),
// Init Raven
RavenModule.forRoot(),
UserModule,
DemoModule,
],
providers: [
{
provide: APP_INTERCEPTOR,
useClass: RavenInterceptor({
filters: [{
type: HttpException, filter: (exception: HttpException) => 500 > exception.getStatus(),
}],
}),
},
],
})
export class ApplicationModule implements NestModule {
public configure(consumer: MiddlewareConsumer): void {
// We apply AuthMiddleware globally and then set access right with guards.
consumer.apply(AuthMiddleware)
.forRoutes('*');
}
}
import { DemoModule } from './demo/demo.module';
import { TypeOrmModule } from '@nestjs/typeorm';
import { RavenInterceptor, RavenModule } from 'nest-raven';
import { APP_INTERCEPTOR } from '@nestjs/core';
@Module({
imports: [
LoggerModule, // Global
AuthenticationModule, // Required for AuthMiddleware
// Init TypeOrm
TypeOrmModule.forRoot(),
// Init Router
RouterModule.forRoutes(appRoutes),
// Init Raven
RavenModule.forRoot(),
UserModule,
DemoModule,
],
providers: [
{
provide: APP_INTERCEPTOR,
useClass: RavenInterceptor({
filters: [{
type: HttpException, filter: (exception: HttpException) => 500 > exception.getStatus(),
}],
}),
},
],
})
export class ApplicationModule implements NestModule {
import { Controller, Get, UseInterceptors } from '@nestjs/common';
import { AppService } from './app.service';
import { RavenInterceptor } from 'nest-raven';
@Controller()
@UseInterceptors(new RavenInterceptor())
export class AppController {
constructor(private readonly appService: AppService) {}
@Get()
getHello(): string {
return this.appService.getHello();
}
}