Code Explainers

Code explainers tagged #interceptors

typescript
import { Injectable, NestInterceptor, ExecutionContext, CallHandler } from '@nestjs/common';
import { Observable, catchError, concatMap, finalize } from 'rxjs';
import { DataSource, QueryRunner } from 'typeorm';
 

Wrapping requests in a transaction with NestJS

interceptors transactions rxjs
Advanced 7 steps
java
@AutoConfiguration
@EnableConfigurationProperties(RateLimiterProperties.class)
@ConditionalOnClass(RateLimiter.class)
public class RateLimiterAutoConfiguration {

Building a Spring Boot rate-limiter auto-config

auto-configuration conditional-beans rate-limiting
Intermediate 7 steps
typescript
import {
  Controller,
  Post,
  UploadedFile,

Handling avatar uploads in NestJS

file-upload validation interceptors
Intermediate 7 steps
typescript
import {
  Injectable,
  NestInterceptor,
  ExecutionContext,

A per-route timeout interceptor in NestJS

interceptors metadata reflection rxjs
Intermediate 8 steps
typescript
import {
  CallHandler,
  ExecutionContext,
  Injectable,

Wrapping responses in a NestJS interceptor

interceptors rxjs response-shaping
Intermediate 7 steps
typescript
import {
  CACHE_MANAGER,
  CacheInterceptor,
} from '@nestjs/cache-manager';

A tenant-aware HTTP cache in NestJS

caching interceptors multi-tenancy
Intermediate 7 steps
typescript
import {
  Injectable,
  NestInterceptor,
  ExecutionContext,

How a NestJS logging interceptor works

interceptors rxjs logging
Intermediate 5 steps