Code Explainers

Code explainers tagged #metadata

javascript
import { notFound } from 'next/navigation'
import { getPhotoById } from '@/lib/photos'
import Modal from '@/components/modal'
import Image from 'next/image'

An intercepted photo modal route in Next.js

dynamic-routes async-components metadata
Intermediate 6 steps
javascript
import { notFound } from 'next/navigation'
import { Suspense } from 'react'
import { getPostBySlug, getRelatedPosts } from '@/lib/posts'
import { RelatedPosts } from '@/components/related-posts'

Building a dynamic blog post page in Next.js

server-components dynamic-routing metadata
Intermediate 8 steps
typescript
import {
  CanActivate,
  ExecutionContext,
  Injectable,

Role-based access with a NestJS guard

authorization guards decorators
Intermediate 6 steps
javascript
import { ImageResponse } from 'next/og'
 
export function manifest() {
  return {

Generating a PWA manifest and icon in Next.js

pwa metadata og-image
Intermediate 9 steps
python
import wave
import os
from dataclasses import dataclass
 

Reading WAV metadata into a dataclass

dataclass audio file-io
Beginner 5 steps
typescript
import {
  CanActivate,
  ExecutionContext,
  Injectable,

How guards chain auth in NestJS

guards authentication authorization
Intermediate 8 steps
typescript
import {
  CanActivate,
  ExecutionContext,
  Injectable,

A rate-limiting guard in NestJS

rate-limiting guards metadata
Intermediate 7 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