Expressjs Roadmap
51 sections • 968 topics
- 1. Installing Express
- Example: Minimal install & run
- 2. Creating Basic Server
- Example: Bootstrap server
- 3. Configuring Application Settings
- 4. Setting Port and Host
- 5. Setting View Engine
- 6. Configuring Views Directory
- Example: Views path
- 7. Enabling Trust Proxy
- 8. Disabling X-Powered-By Header
- Example: Hide framework fingerprint
- 9. Configuring Static File Directory
- Example: Static assets with caching
- 10. Setting Global Template Variables
- Example: Globals
- 1. Installing dotenv Package
- Example: Native env file
- 2. Loading Environment Variables
- Example: dotenv import
- 3. Accessing Variables
- 4. Creating .env File
- Example: .env
- 5. Using Different Environments
- 6. Setting Default Values
- Example: Defaults & coercion
- 7. Validating Required Variables
- Example: Zod schema validation
- 8. Excluding .env from Git
- Example: .gitignore
- 9. Using env-var for Validation
- Example: env-var fluent API
- 10. Setting NODE_ENV to Production
- Example: Cross-platform env setting
- 1. Installing express-generator
- 2. Creating New Projects
- Example: Scaffold project
- 3. Specifying View Engine
- 4. Generating with CSS Preprocessors
- Example: SASS project
- 5. Adding Git Ignore Files
- Example: Generated .gitignore
- 6. Understanding Generated Structure
- 7. Installing Dependencies
- Example: Install + audit
- 8. Starting Generated Application
- 9. Customizing Generated Templates
- 10. Using npx for One-Time Execution
- Example: Quick prototype
- 1. Understanding Application Initialization
- 2. Understanding Middleware Registration Order
- 3. Understanding Request-Response Cycle
- 4. Using Application Events
- Example: Lifecycle hooks
- 5. Handling Startup Initialization
- Example: Async bootstrap
- 6. Understanding Route Matching Order
- 7. Implementing Graceful Startup
- Example: Readiness gate
- 8. Understanding Middleware Stack Execution
- 9. Implementing Application Bootstrap Patterns
- Example: Modular factory
- 10. Understanding Express Settings
- 1. Creating Basic Routes
- Example: Basic CRUD
- 2. Handling All HTTP Methods
- Example: app.all()
- 3. Using Route Methods
- 4. Defining Route Paths
- 5. Using Route Parameters
- Example: Multi-segment params
- 6. Accessing Route Parameters
- 7. Chaining Route Handlers
- Example: app.route() chain
- 8. Using Multiple Handler Functions
- Example: Middleware chain per route
- 9. Implementing Route Arrays
- Example: Multiple paths, same handler
- 10. Creating Modular Routes
- Example: Router module
- 1. Creating Router Instance
- Example: Router with mergeParams
- 2. Defining Router-Level Routes
- 3. Mounting Routers
- Example: Versioned mounting
- 4. Using Router Middleware
- Example: Scoped auth
- 5. Implementing Nested Routers
- Example: Posts under users
- 6. Using Router Parameters
- Example: param() prefetch
- 7. Organizing Routes by Resource
- 8. Creating Route Prefixes
- Example: API versioning prefix
- 9. Exporting Router Modules
- Example: Dependency-injected router
- 10. Handling Router-Level Errors
- Example: Per-router error handler
- 1. Defining URL Parameters
- 2. Accessing Parameters
- Example: Reading params
- 3. Using Multiple Parameters
- Example: Nested resources
- 4. Validating Parameters
- Example: Inline guard + express-validator
- 5. Making Parameters Optional
- Example: Optional segment
- 6. Using param() Middleware
- Example: Centralized lookup
- 7. Pre-processing Parameters
- Example: Coerce + normalize
- 8. Converting Parameter Types
- 9. Handling Invalid Parameters
- Example: 400 vs 404
- 10. Using Wildcard Parameters
- Example: Catch-all
- 1. Accessing Query Parameters
- Example: Basic access
- 2. Reading Single Query Value
- Example: Switch parser
- 3. Handling Array Query Values
- Example: Multi-value query
- 4. Setting Default Query Values
- Example: Defaults & coercion
- 5. Validating Query Parameters
- Example: zod schema
- 6. Converting Query Types
- 7. Handling Missing Query Parameters
- Example: Required vs optional
- 8. Building Query Strings
- Example: URLSearchParams
- 9. Parsing Complex Queries
- Example: qs library
- 10. Implementing Search Queries
- Example: Multi-criteria search
- 1. Understanding Middleware Signature
- Example: Standard vs error
- 2. Creating Application-Level Middleware
- Example: app.use()
- 3. Creating Router-Level Middleware
- Example: Router scope
- 4. Using Built-in Middleware
- 5. Implementing Third-Party Middleware
- 6. Creating Custom Middleware Functions
- Example: Request ID + duration
- 7. Using Middleware for Specific Routes
- Example: Per-route stacks
- 8. Executing Multiple Middleware
- 9. Calling next() Function
- 10. Skipping Remaining Middleware
- Example: next("route") to bypass
- 11. Understanding Middleware Order
- 1. Using express.json() Middleware
- Example: JSON parser with raw access
- 2. Using express.urlencoded() Middleware
- Example: Form parser
- 3. Parsing URL-Encoded Data
- 4. Configuring Body Size Limits
- 5. Handling Parsing Errors
- Example: Catch SyntaxError
- 6. Using body-parser Package
- Example: Standalone body-parser (legacy)
- 7. Parsing Raw Body
- Example: Stripe webhook signature
- 8. Parsing Text Body
- Example: Plain text input
- 9. Setting Content-Type for Parsing
- 10. Verifying Parsed Body
- Example: Capture raw body for HMAC
- 1. Accessing Request Object
- 2. Reading Request Parameters
- Example: req.params
- 3. Reading Query Strings
- 4. Accessing Request Body
- Example: JSON body
- 5. Reading Request Headers
- Example: Bearer token
- 6. Getting Request Method
- 7. Getting Request URL
- 8. Getting Request Path
- Example: Path-based logic
- 9. Checking Request Protocol
- Example: Force HTTPS redirect
- 10. Getting Request Hostname
- 11. Accessing Request IP
- 12. Reading Cookies
- Example: cookie-parser
- 13. Checking Content Type
- Example: req.is()
- 1. Sending Text Response
- Example: res.send variants
- 2. Sending JSON Response
- Example: JSON with status
- 3. Setting Response Status
- 4. Chaining Status and Response
- Example: Fluent chain
- 5. Redirecting Requests
- Example: Redirect variants
- 6. Rendering Views
- Example: Template rendering
- 7. Sending Files
- Example: Send + handle errors
- 8. Downloading Files
- Example: Forced download with custom name
- 9. Setting Response Headers
- Example: Header API
- 10. Setting Content Type
- Example: res.type()
- 11. Appending Headers
- Example: Multi-value Set-Cookie
- 12. Sending Status-Only Response
- 13. Ending Response
- Example: Manual end (streaming)
- 1. Setting Single Header
- 2. Setting Multiple Headers
- Example: Object form
- 3. Appending Headers
- 4. Getting Response Header
- Example: Read what was set
- 5. Removing Headers
- Example: Strip framework fingerprint
- 6. Setting Content-Type
- Example: type() shortcuts
- 7. Setting Cache-Control Headers
- Example: Asset vs API caching
- 8. Setting Custom Headers
- Example: Tracing
- 9. Using Location Header
- Example: 201 with Location
- 10. Setting Vary Header
- Example: Content negotiation
- 1. Understanding res.locals Object
- 2. Setting Request-Scoped Variables
- Example: Attach user
- 3. Sharing Data Between Middleware
- Example: Pipeline state
- 4. Passing Data to Views
- Example: Implicit template context
- 5. Using res.locals vs app.locals
- 6. Implementing User Context
- Example: User middleware
- 7. Creating Flash Messages
- Example: One-shot messages
- 8. Setting Response Metadata
- Example: Pagination links
- 9. Using res.locals for Error Context
- Example: Error template context
- 10. Cleaning Up res.locals
- 1. Using express.static() Middleware
- 2. Setting Static Directory
- Example: Absolute path
- 3. Serving Multiple Static Directories
- Example: Order matters (first found wins)
- 4. Setting Virtual Path Prefix
- Example: Mount under /assets
- 5. Configuring Cache Headers
- Example: Long-cache hashed assets
- 6. Setting Index Files
- 7. Enabling Directory Listing
- Example: serve-index for browsing
- 8. Setting ETag Headers
- 9. Handling Fallback Files
- Example: SPA fallback to index.html
- 10. Serving Hidden Files
- Example: Allow .well-known for ACME
- 1. Installing cookie-parser
- 2. Using cookie-parser Middleware
- Example: With secret for signing
- 3. Reading Cookies
- Example: Read both
- 4. Setting Cookies
- Example: Secure session cookie
- 5. Deleting Cookies
- Example: Logout
- 6. Setting Cookie Options
- 7. Using Signed Cookies
- Example: Signed user cookie
- 8. Reading Signed Cookies
- Example: Verify signed cookie
- 9. Setting Cookie Path and Domain
- 10. Using SameSite Attribute
- 1. Installing express-session
- 2. Configuring Session Middleware
- Example: Production session
- 3. Setting Session Secret
- 4. Configuring Session Store
- 5. Accessing Session Data
- Example: req.session
- 6. Storing Session Variables
- Example: Set + persist
- 7. Destroying Sessions
- Example: Logout
- 8. Regenerating Session ID
- Example: Prevent session fixation on login
- 9. Setting Session Cookie Options
- 10. Using Session with Redis
- Example: Redis store full setup
- 11. Implementing Session Timeout
- Example: Idle + absolute
- 1. Setting View Engine
- 2. Configuring Views Directory
- Example: Multiple view paths
- 3. Rendering Templates
- 4. Passing Data to Views
- Example: Locals merging
- 5. Using EJS Templates
- Example: EJS syntax
- 6. Using Pug Templates
- Example: Pug indentation
- 7. Using Handlebars
- Example: express-handlebars setup
- 8. Creating Partials and Layouts
- Example: EJS partial
- 9. Setting Global Template Variables
- Example: app.locals helpers
- 10. Using Helpers and Filters
- 1. Checking Accept Header
- Example: Manual negotiation
- 2. Responding with JSON
- Example: Standard envelope
- 3. Responding with HTML
- 4. Responding with XML
- Example: XML response
- 5. Using res.format() for Multiple Types
- Example: Format dispatch
- 6. Setting Default Content Type
- 7. Handling Unsupported Types
- Example: 406 Not Acceptable
- 8. Implementing Custom Formatters
- Example: CSV formatter
- 9. Parsing Multiple Content Types
- Example: Multi-type body parsing
- 10. Setting charset in Content-Type
- 1. Installing Multer Middleware
- 2. Configuring Storage
- Example: Memory vs disk storage
- 3. Setting Upload Destination
- 4. Handling Single File Upload
- Example: One file
- 5. Handling Multiple Files
- Example: array() — multiple files, same field
- 6. Handling Multiple Fields
- Example: fields() — different field names
- 7. Accessing Uploaded Files
- 8. Filtering File Types
- Example: fileFilter
- 9. Setting File Size Limits
- Example: 5 MB image limit
- 10. Validating File Extensions
- Example: Combine MIME + extension
- 11. Renaming Uploaded Files
- Example: UUID + extension
- 12. Handling Upload Errors
- Example: MulterError handler
- 1. Installing express-validator
- 2. Creating Validation Rules
- Example: Per-field chains
- 3. Chaining Validation Methods
- 4. Using Custom Validators
- Example: Async DB check
- 5. Sanitizing Input
- 6. Handling Validation Results
- Example: Reusable handler
- 7. Returning Validation Errors
- 8. Creating Reusable Validators
- Example: Shared rules
- 9. Validating Nested Objects
- Example: checkSchema
- 10. Conditional Validation
- Example: optional + if
- 11. Implementing Async Validation
- Example: Multiple async checks
- 1. Understanding Error Flow
- 2. Creating Error Middleware
- Example: Standard error handler
- 3. Handling Synchronous Errors
- Example: Sync throw auto-caught
- 4. Handling Async Errors
- Example: Express 5 native
- Example: Express 4 — wrap with asyncHandler
- 5. Passing Errors to next()
- 6. Creating Custom Error Classes
- Example: HttpError hierarchy
- 7. Setting Error Status Codes
- 8. Formatting Error Responses
- Example: Problem Details (RFC 7807)
- 9. Logging Errors
- Example: pino in error handler
- 10. Handling 404 Not Found
- Example: 404 + delegate
- 11. Differentiating Development vs Production Errors
- Example: Hide stack in prod
- 12. Using express-async-errors Package
- Example: Express 4 patch
- 1. Using async/await in Route Handlers
- Example: Express 5 native
- 2. Creating Async Middleware
- Example: Async auth
- 3. Handling Promise Rejections
- 4. Using express-async-handler Package
- Example: Wrapper utility
- 5. Implementing try-catch Wrappers
- Example: Inline try/catch
- 6. Forwarding Async Errors
- 7. Using Promise.all() for Parallel Operations
- Example: Parallel fetch
- 8. Implementing Async Validation
- Example: zod async refinement
- 9. Handling Async Database Operations
- Example: Transaction
- 10. Using Promise.allSettled() for Multiple Operations
- Example: Best-effort parallel
- 1. Implementing Resource Routes
- Example: Resource router
- 2. Using Proper HTTP Methods
- 3. Setting HTTP Status Codes
- 4. Structuring JSON Responses
- Example: Envelope vs flat
- 5. Implementing Resource Naming
- 6. Using Nested Resources
- Example: Nested router
- 7. Implementing HATEOAS Links
- Example: Hypermedia links
- 8. Handling Bulk Operations
- Example: Bulk create
- 9. Using Proper Error Responses
- Example: Consistent error shape
- 10. Implementing Idempotent Operations
- Example: Idempotency-Key
- 1. Using URL Path Versioning
- Example: Mount per-version
- 2. Creating Version-Specific Routers
- 3. Using Header-Based Versioning
- Example: Accept header
- 4. Using Query Parameter Versioning
- Example: ?version=2
- 5. Organizing Version Files
- 6. Implementing Version Middleware
- Example: Negotiation middleware
- 7. Handling Deprecated Versions
- Example: Deprecation header (RFC 8594)
- 8. Documenting Version Changes
- 9. Setting Default Version
- Example: Latest as default
- 10. Implementing Version Negotiation
- Example: Header + path fallback
- 1. Using Query Parameters
- Example: Parse pagination
- 2. Calculating Offset
- Example: Offset formula
- 3. Querying Database with Limits
- Example: Prisma
- Example: SQL
- 4. Returning Total Count
- Example: Count + items
- 5. Creating Pagination Links
- Example: HAL-style links
- 6. Setting Default Page Size
- 7. Validating Page Numbers
- Example: zod schema
- 8. Implementing Cursor-Based Pagination
- Example: Cursor (id-based)
- 9. Using Link Headers
- Example: RFC 5988 Link header
- 10. Handling Empty Results
- Example: Empty page
- 1. Reading Search Query
- Example: Search param
- 2. Implementing Text Search
- Example: ILIKE (Postgres)
- Example: Prisma contains
- 3. Using Multiple Filters
- Example: AND/OR with Prisma
- 4. Filtering by Date Range
- Example: from/to
- 5. Implementing Fuzzy Search
- Example: Postgres trigram
- 6. Creating Complex Query Builders
- Example: Reusable builder
- 7. Validating Filter Parameters
- Example: zod filter schema
- 8. Using Query Operators
- 9. Implementing Full-Text Search
- Example: Postgres tsvector
- 10. Sanitizing Search Input
- Example: Strip dangerous chars
- 1. Reading Sort Parameters
- Example: ?sort=name,-createdAt
- 2. Implementing Single Field Sorting
- Example: Single field
- 3. Implementing Multi-Field Sorting
- Example: Multi-key parser
- 4. Setting Sort Direction
- 5. Using Default Sorting
- Example: Default to id
- 6. Validating Sort Fields
- Example: Allowlist
- 7. Implementing Case-Insensitive Sorting
- Example: Postgres COLLATE
- 8. Using Database Sorting
- 9. Sorting Nested Fields
- Example: Sort by relation
- 10. Combining Sorting with Filtering
- Example: Filter + sort + paginate
- 1. Installing Passport.js
- Example: Install
- 2. Configuring Passport Middleware
- Example: Init
- 3. Implementing Local Strategy
- Example: Username/password
- 4. Serializing Users
- Example: Store user.id in session
- 5. Deserializing Users
- Example: Load user from id
- 6. Using JWT Authentication
- 7. Creating JWT Tokens
- Example: jwt.sign
- 8. Verifying JWT Tokens
- Example: Verify middleware
- 9. Implementing OAuth Strategies
- Example: Google OAuth 2.0
- 10. Protecting Routes
- Example: Apply requireAuth
- 11. Handling Login and Logout
- Example: Login + logout (JWT cookie)
- 12. Using bcrypt for Passwords
- Example: Hash + compare
- 1. Creating Role-Based Middleware
- Example: requireRole factory
- 2. Checking User Roles
- 3. Implementing Permission Checks
- Example: Permission helper
- 4. Using Access Control Lists
- Example: ACL with accesscontrol
- 5. Protecting Resource Access
- Example: Owner-or-admin
- 6. Implementing Attribute-Based Control (ABAC)
- Example: Policy function
- 7. Creating Authorization Middleware Chain
- Example: Compose
- 8. Handling Unauthorized Access
- Example: 401 vs 403
- 9. Using Scopes for API Access
- Example: OAuth scopes
- 10. Implementing Resource-Level Permissions
- Example: Per-row check
- 1. Installing cors Package
- Example: Install
- 2. Enabling CORS for All Routes
- Example: Default (allow any origin)
- 3. Configuring Allowed Origins
- Example: Allowlist
- 4. Setting Allowed Methods
- Example: methods
- 5. Allowing Credentials
- Example: Credentials
- 6. Setting Exposed Headers
- Example: exposedHeaders
- 7. Setting Preflight Max Age
- Example: maxAge
- 8. Enabling CORS for Specific Routes
- Example: Per-route
- 9. Handling Dynamic Origins
- Example: Subdomain regex
- 10. Pre-flight Request Handling
- 1. Installing helmet Package
- Example: Install
- 2. Using helmet Middleware
- Example: Default helmet
- 3. Preventing XSS Attacks
- Example: Escape in templates + CSP
- 4. Implementing Rate Limiting
- Example: Quick limiter
- 5. Preventing SQL Injection
- Example: Parameterized query
- 6. Sanitizing User Input
- Example: NoSQL injection guard
- 7. Setting Secure Headers
- Example: Custom CSP + HSTS
- 8. Preventing CSRF Attacks
- Example: csrf-csrf double-submit
- 9. Using HTTPS
- Example: Trust proxy + redirect
- 10. Securing Cookies
- 11. Implementing Input Validation
- Example: zod at boundary
- 12. Preventing Parameter Pollution
- Example: hpp middleware
- 1. Installing express-rate-limit
- Example: Install
- 2. Creating Rate Limiter
- Example: Basic limiter
- 3. Setting Window Duration
- 4. Setting Max Requests
- Example: Per-tier
- 5. Customizing Error Messages
- Example: JSON message
- 6. Using Custom Handler
- Example: Custom handler with Retry-After
- 7. Setting Rate Limit Headers
- 8. Implementing Per-Route Limits
- Example: Strict login limiter
- 9. Using Redis Store
- Example: Distributed limiter
- 10. Implementing Sliding Window
- Example: rate-limiter-flexible
- 11. Skipping Certain Requests
- Example: Skip whitelisted IPs / health
- 1. Connecting to MongoDB
- Example: Mongoose
- 2. Connecting to PostgreSQL
- Example: pg Pool
- 3. Connecting to MySQL
- Example: mysql2 pool
- 4. Creating Database Connection Pool
- 5. Handling Connection Errors
- Example: Pool error handler
- 6. Using Environment Variables
- Example: Validated env
- 7. Implementing Connection Retry Logic
- Example: Exponential backoff
- 8. Closing Database Connections
- Example: Graceful shutdown
- 9. Using Database Middleware
- Example: Attach client per request
- 10. Implementing Database Transaction Handling
- Example: Postgres transaction wrapper
- 1. Installing morgan Package
- Example: Install
- 2. Using Predefined Formats
- Example: combined
- 3. Creating Custom Log Formats
- Example: Custom tokens
- 4. Logging to Console
- Example: stdout
- 5. Logging to Files
- Example: Rotating file stream
- 6. Skipping Log Entries
- Example: Skip 2xx and health
- 7. Using winston for Advanced Logging
- Example: winston transports
- 8. Logging Request Duration
- Example: process.hrtime
- 9. Logging Request Body
- Example: Redact sensitive fields
- 10. Implementing Structured Logging
- Example: pino JSON
- 1. Installing compression Package
- Example: Install
- 2. Enabling Response Compression
- Example: Default
- 3. Setting Compression Level
- Example: Custom level
- 4. Filtering Compressible Responses
- Example: Custom filter
- 5. Setting Compression Threshold
- Example: Skip small bodies
- 6. Using Brotli Compression
- Example: shrink-ray-current (Brotli + gzip)
- 7. Disabling Compression for Specific Routes
- Example: Skip SSE
- 8. Checking Content Encoding Headers
- 9. Testing Compressed Responses
- Example: curl
- 10. Optimizing Compression Performance
- 1. Setting Cache-Control Headers
- Example: Public CDN cache
- 2. Using ETag Headers
- Example: ETag enabled by default
- 3. Implementing Browser Caching
- Example: Static assets
- 4. Using apicache Package
- Example: Install + use
- 5. Caching Specific Routes
- Example: Per-route TTL
- 6. Setting Cache Duration
- 7. Invalidating Cache
- Example: apicache clear
- 8. Using Redis for Caching
- Example: Cache-aside helper
- 9. Implementing Cache-Aside Pattern
- 10. Setting No-Cache Directives
- Example: Sensitive endpoint
- 1. Understanding Node.js Streams
- 2. Piping Streams to Response
- Example: Pipe a file
- 3. Reading Large Files
- Example: Highwatermark
- 4. Sending Streaming Responses
- Example: Stream JSON array
- 5. Handling Stream Errors
- Example: pipeline()
- 6. Using Transform Streams
- Example: Inline gzip
- 7. Implementing Backpressure
- Example: Honor write() return
- 8. Streaming File Uploads
- Example: Stream upload to S3
- 9. Using stream.pipeline() Method
- Example: Multi-stage pipeline
- 10. Implementing Server-Sent Events (SSE)
- Example: SSE basics
- 1. Understanding SSE Protocol
- 2. Setting SSE Response Headers
- Example: Required headers
- 3. Sending Event Data
- Example: write line
- 4. Formatting SSE Messages
- Example: Helper
- 5. Implementing Event Types
- Example: Multiple event names
- 6. Handling Client Reconnection
- Example: Resume from Last-Event-ID
- 7. Setting Retry Interval
- Example: Tell client to retry in 10s
- 8. Keeping Connection Alive
- Example: Heartbeat comment
- 9. Broadcasting Events to Clients
- Example: Pub/sub fanout
- 10. Closing SSE Connections
- Example: Server-initiated close
- 1. Creating Factory Functions
- Example: Configurable middleware factory
- 2. Implementing Conditional Middleware
- Example: ifEnv helper
- 3. Using Middleware Composition
- Example: compose
- 4. Creating Configurable Middleware
- Example: Options + defaults
- 5. Implementing Error Recovery Middleware
- Example: Retry on transient error
- 6. Using Middleware for Request Transformation
- Example: Trim string fields
- 7. Implementing Response Time Middleware
- Example: response-time
- 8. Creating Request ID Middleware
- Example: Request ID
- 9. Implementing Throttling Middleware
- Example: Per-user concurrency limit
- 10. Using Middleware for Feature Flags
- Example: Flag-gated route
- 1. Installing http-proxy-middleware
- Example: Install
- 2. Creating Proxy Middleware
- Example: Basic proxy
- 3. Configuring Target URL
- 4. Enabling Path Rewriting
- Example: Strip prefix
- 5. Handling WebSocket Proxying
- Example: ws: true
- 6. Setting Proxy Timeout
- Example: timeouts
- 7. Implementing Load Balancing Logic
- Example: Round-robin router
- 8. Using Router Function
- Example: Route by tenant
- 9. Handling Proxy Errors
- Example: onError
- 10. Logging Proxy Requests
- Example: logger option
- 1. Installing socket.io Package
- Example: Install
- 2. Creating Socket.io Server
- Example: Attach to HTTP server
- 3. Handling Connection Events
- Example: connection
- 4. Emitting Events
- Example: socket.emit
- 5. Broadcasting Events
- 6. Joining Rooms
- Example: Join room
- 7. Leaving Rooms
- Example: Leave
- 8. Emitting to Rooms
- Example: Targeted emit
- 9. Handling Disconnection
- Example: Cleanup
- 10. Using Namespaces
- Example: Admin namespace
- 11. Implementing Middleware
- Example: JWT auth on handshake
- 1. Creating Health Check Endpoint
- Example: Minimal /health
- 2. Returning Health Status
- 3. Checking Database Connectivity
- Example: pg ping
- 4. Checking External Dependencies
- Example: Redis + downstream API
- 5. Implementing Liveness vs Readiness Probes
- Example: Three probes
- 6. Setting Health Check Timeouts
- Example: AbortSignal.timeout
- 7. Returning Detailed Health Information
- Example: RFC Health Check Response Format
- 8. Using express-healthcheck Package
- Example: terminus
- 9. Implementing Circuit Breaker Pattern
- Example: opossum
- 10. Monitoring Health Check Metrics
- Example: prom-client
- 1. Installing i18n Package
- Example: Install
- 2. Configuring i18n Middleware
- Example: i18next setup
- 3. Setting Supported Locales
- 4. Detecting User Locale
- Example: Manual detection
- 5. Creating Translation Files
- Example: locales/en/translation.json
- 6. Using Translation Functions
- Example: req.t()
- 7. Pluralization Handling
- Example: Plural via count
- 8. Setting Default Locale
- Example: fallbackLng
- 9. Using URL-Based Locale
- Example: /:locale prefix
- 10. Implementing Cookie-Based Locale
- Example: Persist preference
- 1. Installing swagger-ui-express
- Example: Install
- 2. Creating OpenAPI Specification
- Example: openapi.yaml (3.1)
- 3. Defining API Endpoints
- Example: Endpoint definition
- 4. Documenting Request Parameters
- 5. Documenting Response Schemas
- Example: Schema component
- 6. Setting Up Swagger UI
- Example: Mount UI
- 7. Using swagger-jsdoc for Annotations
- Example: JSDoc annotations
- 8. Documenting Authentication
- Example: securitySchemes
- 9. Generating Documentation from Routes
- Example: zod-openapi
- 10. Versioning API Documentation
- Example: Mount per-version
- 1. Using Clustering
- Example: Cluster module
- 2. Enabling Gzip Compression
- Example: At edge
- 3. Implementing Caching Strategies
- 4. Using Connection Pooling
- Example: pg Pool
- 5. Optimizing Database Queries
- 6. Lazy Loading Resources
- Example: Dynamic import
- 7. Using CDN for Static Assets
- 8. Implementing Response Streaming
- Example: ndjson streaming
- 9. Minimizing Middleware Stack
- Example: Scoped middleware
- 10. Using HTTP/2 with SPDY
- Example: Node http2 + Express
- 11. Profiling Performance
- 12. Monitoring Memory Usage
- Example: Memory metrics
- 1. Using Debug Module
- Example: DEBUG env
- 2. Enabling Express Debug Output
- 3. Using Node.js Debugger
- Example: --inspect
- 4. Setting Breakpoints
- Example: debugger statement
- 5. Using console.log() Statements
- Example: Tagged logs
- 6. Installing morgan for Logging
- Example: morgan dev
- 7. Using VS Code Debugger
- Example: launch.json
- 8. Inspecting Request/Response Objects
- Example: console.dir
- 9. Using Chrome DevTools
- Example: chrome://inspect
- 10. Analyzing Stack Traces
- Example: source-map-support
- 11. Using nodemon for Auto-Restart
- Example: node native watch
- 1. Installing Testing Libraries
- Example: vitest + supertest
- 2. Installing supertest Package
- Example: Install
- 3. Creating Test Suites
- Example: vitest describe/it
- 4. Writing Unit Tests
- Example: Pure function test
- 5. Writing Integration Tests
- Example: Full app + DB
- 6. Using supertest for HTTP Requests
- Example: Methods
- 7. Testing Route Handlers
- Example: All verbs
- 8. Asserting Response Status
- Example: Multiple assertions
- 9. Asserting Response Body
- Example: Match shape
- 10. Mocking Database Calls
- Example: vi.mock
- 11. Setting Up Test Database
- 12. Testing Middleware Functions
- Example: Mount on tiny app
- 13. Testing Error Handlers
- Example: Force error route
- 1. Installing TypeScript Dependencies
- Example: Install
- 2. Creating tsconfig.json Configuration
- Example: tsconfig.json
- 3. Typing Request and Response
- Example: Typed handler
- 4. Creating Custom Request Types
- Example: Module augmentation
- 5. Typing Middleware Functions
- Example: RequestHandler
- 6. Using Generic Types
- Example: Request<Params, ResBody, ReqBody, Query>
- 7. Creating Type-Safe Route Handlers
- Example: Wrapper
- 8. Typing Express Application
- Example: Express type
- 9. Using Type Guards
- Example: Narrow error
- 10. Compiling TypeScript
- Example: package.json scripts
- 1. Installing express-graphql
- Example: Install (modern)
- 2. Creating GraphQL Schema
- Example: SDL
- 3. Defining Types
- 4. Creating Resolvers
- Example: Resolvers
- 5. Setting Up GraphQL Endpoint
- Example: Apollo + Express 5
- 6. Using graphqlHTTP Middleware
- Example: graphql-yoga
- 7. Enabling GraphiQL Interface
- Example: Apollo Sandbox / Yoga GraphiQL
- 8. Handling Queries
- Example: Curl query
- 9. Handling Mutations
- Example: Mutation
- 10. Implementing Authentication
- Example: Context-based auth
- 11. Using DataLoader for Batching
- Example: Batch + cache N+1
- 1. Setting NODE_ENV to Production
- Example: env
- 2. Using Process Managers
- 3. Configuring PM2
- Example: ecosystem.config.cjs
- 4. Setting Up Reverse Proxy
- Example: Nginx
- 5. Implementing Graceful Shutdown
- Example: SIGTERM handler
- 6. Using Environment-Specific Config
- Example: Validated config
- 7. Enabling HTTPS
- Example: TLS termination
- 8. Implementing Health Check Endpoints
- Example: For Kubernetes
- 9. Setting Up Logging
- Example: pino → stdout
- 10. Monitoring Application
- Example: OpenTelemetry auto-instrumentation
- 11. Containerizing with Docker
- Example: Multi-stage Dockerfile
- 12. Deploying to Cloud Platforms
- Production Checklist