POST()function
POST(path: AbsolutePath, payload?: Schema<P>, result?: Schema<R>): Endpoint<P, R>
POST(path: AbsolutePath, payload: Schema<P>): Endpoint<P, undefined>
POST(path: AbsolutePath, payload: undefined, result: Schema<R>): Endpoint<undefined, R>
| Param | Type | |
|---|---|---|
path | AbsolutePath | The endpoint path, possibly including {placeholders} required |
payload | Schema<P> | An optional Schema validating the request payload. |
result | Schema<R> | An optional Schema validating the response result. |
path | AbsolutePath | Absolute path string starting with a / slash. required |
payload | Schema<P> | Schema is an object instance with a validate() method that converts unknown input into a known, valid type T. required |
payload | undefined | required |
result | Schema<R> | Schema is an object instance with a validate() method that converts unknown input into a known, valid type T. required |
| Return | |
|---|---|
Endpoint<P, R> | |
Endpoint<P, undefined> | A typed API resource definition pairing a method and path with payload and result schemas. |
Endpoint<undefined, R> | A typed API resource definition pairing a method and path with payload and result schemas. |
Examples
POST("/users", USER, USER_RESULT)