Class: RouteMapper<IncomingEventType, OutgoingResponseType>
Class: RouteMapper<IncomingEventType, OutgoingResponseType>
Maps route definitions into concrete Route
instances.
Type Parameters
IncomingEventType
IncomingEventType
extends IIncomingEvent
= IIncomingEvent
Represents the type of incoming HTTP events.
OutgoingResponseType
OutgoingResponseType
= unknown
Represents the type of outgoing HTTP responses.
Constructors
Constructor
new RouteMapper<IncomingEventType, OutgoingResponseType>(options): RouteMapper<IncomingEventType, OutgoingResponseType>;
Constructs a RouteMapper instance.
Parameters
options
RouteMapperOptions
<IncomingEventType
, OutgoingResponseType
>
Configuration options for the RouteMapper.
Returns
RouteMapper
<IncomingEventType
, OutgoingResponseType
>
Throws
If maxDepth
is not a positive integer.
Methods
toRoutes()
toRoutes(definitions): Route<IncomingEventType, OutgoingResponseType>[];
Maps route definitions into Route instances.
Parameters
definitions
RouteDefinition
<IncomingEventType
, OutgoingResponseType
>[]
An array of route definitions.
Returns
Route
<IncomingEventType
, OutgoingResponseType
>[]
An array of Route instances.
create()
static create<IncomingEventType, OutgoingResponseType>(options): RouteMapper<IncomingEventType, OutgoingResponseType>;
Factory method to create a RouteMapper instance.
Type Parameters
IncomingEventType
IncomingEventType
extends IIncomingEvent
= IIncomingEvent
OutgoingResponseType
OutgoingResponseType
= unknown
Parameters
options
RouteMapperOptions
<IncomingEventType
, OutgoingResponseType
>
Configuration options for the RouteMapper.
Returns
RouteMapper
<IncomingEventType
, OutgoingResponseType
>
A new RouteMapper instance.