Skip to Content
Drash v3 is in beta. APIs may change.
ReferenceModulesBuildersRequestChainBuilder

RequestChainBuilder

The request chain’s builder, reached through Application.builder() rather than directly.

import { requestChain } from "@drashland/drash/modules/builders/RequestChainBuilder.js";

Returns a builder to help you create a request chain.

Good to know

The HTTP module’s Application.builder() calls this and supplies a URLPattern implementation under the hood, so building an app is normally done using Application.builder(), not requestChain().

The returned object is typed as the Builder interface, which exposes exactly three methods:

MethodReturnsNotes
resources(...resources)BuilderThe resource classes this chain routes to
urlPatternClass(cls)BuilderRequired — build() throws without it
build()HandlerThe chain head, whose handle() you call

The handler() and handlers members inherited from AbstractChainBuilder are deliberately not on this interface. The request chain’s handlers, and the order they run in, are decided by build() and are not the consumer’s to change — see Handlers.

Implements IBuilder by way of AbstractChainBuilder, which it extends. The Builder interface it exposes is its own — see the three things named Builder.

Last updated on