StackPractices

Tag: http

Browse 29 practical software engineering resources tagged with "http". Discover code recipes, design patterns, documentation templates, and in-depth guides to help you build, deploy, and maintain production-ready solutions involving http. Each resource is written for engineers who ship real systems, with copy-paste examples and practical trade-offs.

HTTP and Web Protocols

HTTP is the foundation of the web. Understanding methods, headers, status codes, caching, connection management, and security headers is essential for building reliable APIs and web applications.

The recipes below cover HTTP clients, server configuration, status code usage, header security, compression, keep-alive, and protocol semantics. Each resource focuses on practical HTTP behavior that affects production systems.

Every resource includes clear explanations, copy-paste code, and practical warnings. Use them to make informed decisions, avoid production pitfalls, and speed up your delivery. If you are just getting started, read the beginner-friendly articles first; if you are experienced, jump straight to the advanced patterns and architecture guides. New resources are added regularly, so bookmark this page and check back for the latest patterns.

OpenAPI 3.1 API Docs with Swagger UI and Redoc

A practical guide to documenting REST APIs with OpenAPI. Generate interactive Swagger UI and Redoc...

Implement API Logging and Audit Trails

Set up thorough request/response logging and audit trails for APIs with structured output,...

API Versioning: URL, Header & Media Type Strategies

How to version REST APIs with URL path, header, and media-type strategies while keeping backward...

Call a REST API: Python, JavaScript, Java & Go Examples

How to make HTTP requests to a REST API and handle the JSON response in Python, JavaScript, Java,...

Cursor-Based Pagination in PostgreSQL (Keyset vs OFFSET)

Implement efficient cursor-based pagination for large datasets in PostgreSQL, avoiding OFFSET...

Go REST API with Gin and Middleware

Build production-ready REST APIs in Go using the Gin framework with custom middleware for logging,...

Implement a GraphQL API

Build a production-ready GraphQL API with typed schemas, resolvers, and mutations in Python,...

gRPC API with Protocol Buffers

Implement a gRPC API with Protocol Buffers. Covers service definition, code generation,...

Handle CORS in Express, Flask and Spring Boot

How to configure Cross-Origin Resource Sharing (CORS) headers correctly for APIs, SPAs, and...

Handle API Errors with RFC 7807 and HTTP Status Codes

Patterns for consistent, predictable API error handling across multiple languages and frameworks.

Idempotent API Endpoints

How to design and implement idempotent API endpoints that safely handle retries, duplicate...

Input Validation: Schema-First Examples in 3 Languages

Validate user input at the API boundary with schema libraries. Pydantic, Zod, and Jakarta...

JavaScript Fetch Retry Logic with Exponential Backoff

Retry failed HTTP requests in JavaScript with exponential backoff

Middleware: HTTP Request Interceptors

How to implement request/response middleware for logging, auth, and error handling across Python,...

Pagination

How to implement cursor-based and offset-based pagination in APIs and databases across Python,...

Rate Limiting

How to implement API rate limiting using token bucket, sliding window, and fixed window algorithms...

REST API Design: What Works

Design reliable, scalable REST APIs with proper HTTP methods, status codes, versioning, and...

Server-Sent Events (SSE): One-Way Real-Time Streaming

Implement one-way real-time streaming from server to browser using Server-Sent Events. Covers...

Implement Server-Sent Events in Go for Real-Time Updates

Build a production-ready Server-Sent Events endpoint in Go with connection management, heartbeat...

Webhooks

How to create and consume webhook endpoints for real-time event-driven integrations.