import { CallHandler , ExecutionContext , Injectable , NestInterceptor } from '@nestjs/common' ; import { Observable } from 'rxjs' ; import { timeout } from 'rxjs/operators' ; @ Injectable ( ) export class TimeoutInterceptor implements NestInterceptor { intercept ( context , next ) { return next . handle ( ) . pipe ( timeout ( 5000 ) ) ; } }