Dynamic
Elijah Cobb edited this page Jan 18, 2020
·
3 revisions
On any endpoint group you can set a dynamic endpoint. This will let you support something like GET - /user/x
where x
is the id
of a user. You can use the getEndpoint()
method available on a HRequest
instance to get the x
part of the endpoint or if the id
was 1234
use getUrl()
to get "/user/1234"
.
To define a dynamic endpoint simply provide a HEndpointConstructorType
or a HEndpointHandler
to getDynamic()
, postDynamic()
, etc. For more information on defining endpoints view the endpoint page.
Created by Elijah Cobb provided under the MIT license.
- Home
- Examples
- Creating an Endpoint
- Requests
- Responses
- Files
- Enforcing Types
- Endpoint Groups
- Creating a Server
- Using
HObject
- Error Handling
- Dynamic Endpoints
- Post Process Handler
Element is a group of developer tools I have built in TypeScript. Check them out at: element-ts.com.
Author: Elijah Cobb
NPM: @element-ts/hydrogen
Issue Reporting: Github Issues