Skip to content

http/rs/resource-mappings

Documentation

Overview

Classes

ResourceMappings

path()

Creates or retrieves a Resource object corresponding to the given path. The second, optional argument can be used to initialize the resource.

ts
path(sPath: string, oConfiguration: any): Resource;
ParameterTypeDescription
sPathstringThe URL path template for the resource (e.g., "users/{id}").
oConfigurationanyOptional configuration object for initial resource setup.

Returns

  • Type: Resource
  • Description: The created or existing Resource instance.

resourcePath()

Alias for path().

ts
resourcePath(sPath: string, oConfiguration: any): Resource;
ParameterTypeDescription
sPathstring
oConfigurationany

Returns

  • Type: Resource
  • Description:

resource()

Alias for path().

ts
resource(sPath: string, oConfiguration: any): Resource;
ParameterTypeDescription
sPathstring
oConfigurationany

Returns

  • Type: Resource
  • Description:

configuration()

Returns the compiled configuration object for all resources managed by this ResourceMappings. The configuration is structured to be consumed by the HttpController's routing logic.

ts
configuration(): void;

Returns

  • Type: void
  • Description:

readonly()

Removes all but GET resource handlers from all managed resources, making them read-only.

ts
readonly(): this;

Returns

  • Type: this
  • Description: The ResourceMappings instance for method chaining.

disable()

Disables resource handling specifications matching the arguments, effectively removing them from this API.

ts
disable(sPath: string, sVerb: string, arrConsumes: any, arrProduces: any): this;
ParameterTypeDescription
sPathstringThe path of the resource.
sVerbstringThe HTTP verb (e.g., 'get', 'post').
arrConsumesanyArray of consumed media types.
arrProducesanyArray of produced media types.

Returns

  • Type: this
  • Description: The ResourceMappings instance for method chaining.

find()

Provides a reference to a handler specification matching the supplied arguments.

ts
find(sPath: string, sVerb: string, arrConsumes: any, arrProduces: any): any;
ParameterTypeDescription
sPathstringThe path of the resource.
sVerbstringThe HTTP verb (e.g., 'get', 'post').
arrConsumesanyArray of consumed media types.
arrProducesanyArray of produced media types.

Returns

  • Type: any
  • Description: The matching Resource handler specification or undefined.