Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Vatsalya-singhi/c69f36ee9c3154a74fcf9d5c82111ddd to your computer and use it in GitHub Desktop.
Save Vatsalya-singhi/c69f36ee9c3154a74fcf9d5c82111ddd to your computer and use it in GitHub Desktop.
import { Injectable, NestInterceptor, ExecutionContext, CallHandler } from '@nestjs/common';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
@Injectable()
export class TransformInterceptor implements NestInterceptor {
intercept(context: ExecutionContext, next: CallHandler): Observable<any> {
return next.handle().pipe(
map(data => ({
success: true,
data,
}))
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment