API: resource-mappings
Source:
http/rs/resource-mappings.ts
The ResourceMappings class abstracts the mappings between resource URL path templates and their corresponding resource handler specifications. It acts as the configuration store for the HttpController.
Classes
ResourceMappings
The ResourceMappings class abstracts the mappings between resource URL path templates
and their corresponding resource handler specifications. It acts as the configuration
store for the HttpController.
Methods
path
path (sPath:string, oConfiguration?:any):ResourceCreates or retrieves a Resource object corresponding to the given path.
The second, optional argument can be used to initialize the resource.
@param sPath The URL path template for the resource (e.g., "users/{id}").
@param oConfiguration Optional configuration object for initial resource setup.
@returns The created or existing Resource instance.
resourcePath
resourcePath (sPath:string, oConfiguration?:any):ResourceAlias for path().
resource
resource (sPath:string, oConfiguration?:any):ResourceAlias for path().
configuration
configuration ():any}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.
readonly
readonly ():thisRemoves all but GET resource handlers from all managed resources, making them read-only.
@returns The ResourceMappings instance for method chaining.
disable
disable (sPath:string, sVerb:string, arrConsumes:string[], arrProduces:string[]):thisDisables resource handling specifications matching the arguments, effectively removing them from this API.
@param sPath The path of the resource.
@param sVerb The HTTP verb (e.g., 'get', 'post').
@param arrConsumes Array of consumed media types.
@param arrProduces Array of produced media types.
@returns The ResourceMappings instance for method chaining.
find
find (sPath:string, sVerb:string, arrConsumes:string[], arrProduces:string[]):any|undefinedProvides a reference to a handler specification matching the supplied arguments.
@param sPath The path of the resource.
@param sVerb The HTTP verb (e.g., 'get', 'post').
@param arrConsumes Array of consumed media types.
@param arrProduces Array of produced media types.
@returns The matching Resource handler specification or undefined.