新建拦截器nest generate interceptor logging core/interceptors

This commit is contained in:
Jeremy Yin 2019-06-19 22:49:45 +08:00
parent f887fbcf91
commit 9d695d3f52
2 changed files with 16 additions and 0 deletions

View File

@ -0,0 +1,7 @@
import { LoggingInterceptor } from './logging.interceptor';
describe('LoggingInterceptor', () => {
it('should be defined', () => {
expect(new LoggingInterceptor()).toBeDefined();
});
});

View File

@ -0,0 +1,9 @@
import { CallHandler, ExecutionContext, Injectable, NestInterceptor } from '@nestjs/common';
import { Observable } from 'rxjs';
@Injectable()
export class LoggingInterceptor implements NestInterceptor {
intercept(context: ExecutionContext, next: CallHandler): Observable<any> {
return next.handle();
}
}