A NestJS controller is the boundary that receives HTTP requests and sends responses to clients. Decorators such as `@Controller()`, `@Get()`, and `@Post()` connect URL paths and methods to class methods. Keep request and response handling at this boundary, and delegate data access or complex application work to a provider such as a service so each responsibility is easier to understand and review.
Content addressing identifies a file or object by a digest calculated from its content instead of by its name. The same bytes produce the same ID, while changed bytes produce another ID; this can reduce duplicate storage and help verify that fetched content has not changed. Before using it in an API, define exactly which bytes are hashed and which algorithm is used. Do not treat a digest as authorization or proof of who uploaded the content.
Consumer-driven contract (CDC) testing records only the requests and responses a consumer actually depends on, then checks whether the provider satisfies them. With Pact, consumer tests interact with a mock provider and create a pact file; provider tests replay its requests against provider code and verify the results. This checks an integration boundary. It is not an end-to-end test of the whole system or proof of every business outcome.
HTTP connection reuse lets a client send multiple requests over existing transport connections, avoiding repeated connection and TLS setup. Creating a new client object for every request can create a separate pool and erase that benefit. Reuse the client or handler, release response bodies, and account for DNS changes and shared cookie state.
A connection pool reuses database connections so each request does not need to create a new one. A larger pool does not automatically increase throughput. Set a modest cap and tune it under load while considering the database's concurrency budget, application instance count, connection hold time, and acquisition timeout.
Connection draining is the process of removing a server or instance from new traffic before replacement, scale-down, or shutdown, while giving work already accepted a bounded time to finish. Sending a process a termination signal alone does not ensure that the load balancer stops routing to it or that the application finishes its requests. Draining coordinates the traffic layer, application, and orchestrator against one shutdown deadline.
An API compatibility policy defines which changes are safe for existing consumers and which require a new version or transition period. It should cover response meaning, defaults, serialization, and generated clients—not just adding or removing fields. Do not assume that every additive change is safe or that incrementing a version number alone makes a change safe.
A circuit breaker temporarily blocks calls after recent failures to a remote service or shared resource cross a threshold. It prevents more requests from piling up when they are likely to fail. Retries assume a brief failure may soon recover; a circuit breaker decides that calls should pause. This protects both the dependency’s recovery time and the caller’s resources.
Chunked transfer coding frames an HTTP/1.1 body as size-marked chunks when the total length is not known in advance. A zero-size last chunk marks the end. It is not an application upload protocol that splits one upload into independent requests, and it cannot be used in HTTP/2.
The Common Gateway Interface (CGI) lets an HTTP server pass request information to an external program and turn that program’s output into an HTTP response. The application receives request method, path, and some header information as environment-style meta-variables, reads a request body from standard input, and writes response headers and body to standard output. This guide follows the CGI/1.1 contract described in RFC 3875 and makes clear that the RFC is not an Internet Standard.
When a client no longer needs a response or a request deadline expires, the server should pass cancellation to the child RPCs, queries, and computations started for that request. Receiving a cancellation signal does not automatically stop application work. Each operation must observe cancellation, stop safely, and release the resources it owns.
Caddy uses a site address in the Caddyfile to handle requests. When that address contains a domain name, Caddy automatically obtains and renews certificates and redirects HTTP to HTTPS. The reverseproxy directive forwards requests to a backend. This guide configures one public hostname for one HTTP backend and covers prerequisites, verification, and failure diagnosis. Local development certificates, Kubernetes, multiple backends, and advanced TLS policy are out of scope.
A cache keeps frequently read values in faster storage to reduce repeat-read latency or load on the source. In cache-aside, the application checks the cache, loads misses from the source, and invalidates the related entry after a write. A cache is not the source of truth, and TTL or invalidation policy can allow stale values. This guide covers application caches in front of a database, not vendor-specific setup.
Start Bun’s HTTP server with Bun.serve. Bun 1.2.3 and later support a routes table for fixed paths, parameters, and method-specific handlers; unmatched requests can go to fetch. This example is a local JSON API bound only to 127.0.0.1, not a public deployment recipe. Official docs checked 2026-11-20.
The Bulkhead pattern divides service or consumer resources into separate pools so a fault or overload in one area does not exhaust resources for other functions. For example, a slow payment provider can fill its dedicated connection or worker pool while capacity for product lookups remains available. Isolation does not eliminate a failure; it limits its blast radius.
A bulk operation endpoint is an API designed to process many resources or operations of the same kind at once. Unlike a batch endpoint that wraps several individual HTTP requests in one envelope, it usually applies one domain operation to many targets. Its contract should define synchronous or asynchronous processing, atomic or partial outcomes, per-item errors, and status lookup.
When an API accepts a file or binary payload, send the original bytes as the request body and use the media type required by the endpoint. application/octet-stream is a general choice for arbitrary bytes; when the format is known, such as JPEG or PDF, use its specific media type.
A bearer token is a credential that lets whoever holds it access a protected resource without separate cryptographic proof. In OAuth 2.0 Bearer usage, clients usually send an access token in the Authorization: Bearer <access-token header. Because someone else can use a leaked token, send it over HTTPS, keep it out of URLs, and limit its privileges and intended audience.
A batch endpoint sends several subrequests in one outer HTTP request body. It can reduce network round trips, but the batch is not automatically one atomic operation and all items do not necessarily succeed together. The API must define per-request results, execution order, transaction boundaries, size limits, and error handling as separate parts of its contract.
A background job runs later or on a schedule, separately from a user request. A short in-process queue can be simple, but durable queues and separate workers are safer when work must survive restarts or absorb bursts. Design status tracking, duplicate handling, and recovery together.