Skip to content
StackPractices

Tag: http

Browse 30 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.

Create API Documentation with OpenAPI

Generate interactive API docs from OpenAPI specs using Swagger UI, Redoc, and native tools in Python, JavaScript, and Java.

Implement API Logging and Audit Trails

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

API Versioning

How to version REST and GraphQL APIs to maintain backward compatibility while evolving your interface.

Call a REST API

How to make HTTP requests to a REST API and handle the JSON response in multiple languages.

Cursor-Based Pagination with PostgreSQL

Implement efficient cursor-based pagination for large datasets in PostgreSQL, avoiding OFFSET performance degradation with indexed keyset pagination and stable sort ordering

Go REST API with Gin and Middleware

Build production-ready REST APIs in Go using the Gin framework with custom middleware for logging, authentication, validation, and error handling

Implement a GraphQL API

Build a production-ready GraphQL API with type-safe schemas, resolvers, and query optimization in Python, JavaScript, and Java.

Implement a gRPC API with Protocol Buffers

How to implement a gRPC API using Protocol Buffers for high-performance service-to-service communication

gRPC Services with Protocol Buffers in TypeScript

Build high-performance, strongly-typed services using gRPC with Protocol Buffers, covering unary calls, server streaming, client streaming, and bidirectional streaming

Handle CORS Correctly

How to configure Cross-Origin Resource Sharing (CORS) headers correctly for APIs, SPAs, and serverless functions without opening security holes.

Handle Errors in APIs

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 requests, and network failures without side effects.

Input Validation

How to validate user input safely using schemas, type checking, and sanitization across Python, JavaScript, and Java.

Logging

How to implement structured, level-based logging across Python, JavaScript, and Java with what works for production observability.

Middleware

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

Pagination

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

Rate Limiting

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

Build Real-Time Notifications with WebSockets

Implement a real-time notification system using WebSockets and Redis pub/sub for broadcasting messages across clients.

REST API Design: What Works

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

Send Emails with SMTP

How to send transactional and bulk emails securely using SMTP with template support.

Server-Sent Events (SSE)

How to implement one-way real-time streaming from server to browser using Server-Sent Events, with reconnection, event types, and multi-client broadcasting.

Webhooks

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

WebSocket Server

How to build a WebSocket server for bidirectional real-time communication, with connection management, message broadcasting, and heartbeat keepalive.

HTTP Cache-Control Headers for APIs and Static Assets

Set Cache-Control, ETag, and Last-Modified headers to control browser and CDN caching for API responses and static assets

Make Concurrent HTTP Requests with Python and aiohttp

Fetch multiple APIs concurrently using asyncio and aiohttp. Covers connection pooling, rate limiting, retries, and batch processing.

Stub External HTTP Services with WireMock

How to use WireMock in Java tests to stub external HTTP services, including response templating, delay simulation, and stateful mock behavior.

Mock Network Requests with MSW

How to use Mock Service Worker (MSW) to intercept network requests in JavaScript tests and development, including REST and GraphQL mocking.

Mock External APIs with responses Library

How to mock HTTP API calls in Python tests using the responses library, including status codes, headers, JSON bodies, and error simulation.

REST API Design Guide

A thorough guide to designing clean, scalable, and maintainable REST APIs.