carbond.Endpoint¶
The Endpoint class is a core abstraction in carbond which models an API as a tree of Endpoint instances, each of which is responsible for defining how to handle a given request to a particular URI
Static Properties¶
- ¶
- ALL_METHODS - Object- Required - Description - A list of all HTTP methods recognized by carbond 
 
Instance Properties¶
- ¶
- allowUnauthenticated - string[]- Required - Description - Skip authentication for the HTTP methods listed on this endpoint 
 - ¶
- description - string- Default - undefined - Description - A brief description of what this endpoint does. This will be displayed in any generated documentation. 
 - ¶
- endpoints - Object.<string, carbond.Endpoint>- Required - Description - The endpoints that sit below this endpoint in the tree. URL paths to each endpoint are built during a depth first traversal of the tree on initialization using the property names defined on this Object. 
 - ¶
- noDocument - boolean- Default - false - Description - Controls whether documentation for this endpoint is included in generated static documentation 
 - ¶
- parameters - Object.<string, carbond.OperationParameter>- Required - Description - Operation parameter definitions that apply to all operations supported by this endpoint. Note, these will be merged with any parameter definitions on the operations themselves and their parsed values will be passed to the handler via - req.parameters[<parameter name>].
 - ¶
- parent (read-only)- Description - The parent endpoint for this endpoint in the endpoint tree 
 - ¶
- path - string(read-only)- Description - The URI path that routes to this endpoint. This is built during service initialization and will overwrite any value specified on instantiation. 
 
Methods¶
- ¶
- getOperation - Arguments - method (string) – The HTTP method corresponding to the operation to retrieve
 - Return type - Operation- Description - Retrieves the operation instance corresponding to the passed HTTP method 
 - ¶
- getService - Return type - Service- Description - Returns the root - Serviceinstance (note, this is preferred over accessing the- serviceproperty itself)
 - ¶
- isOperationAuthorized - Arguments - method (string) – The HTTP method corresponding to the operation that we are attempting to authorize
- user (Object) – The user object
- req (Request) – The request object
 - Returns - Whether of not the operation is authorized - Return type - boolean - Description - Tests whether an operation is authorized given a user (as returned by the root authenticator) and any - Aclthat may apply to this endpoint
 - ¶
- operations - Return type - Operation[]- Description - Gathers all operations defined on this endpoint 
 - ¶
- options - Arguments - Return type - undefined - Description - Implements the OPTIONS method handler 
 - ¶
- supportedMethods - Return type - string[] - Description - Returns a list of HTTP methods supported by this endpoint