- Source:
Properties:
| Name | Type | Description |
|---|---|---|
routes |
Object | This servers routes, defined. |
verbs |
Object | The HTTP verbs we can use, ['head', 'get', 'post', 'put', 'patch', 'delete']. |
Countains routing options for web clients. Can associate routes with actions or files.
Extends
Methods
(static) registerRoute(method, path, action, apiVersion, matchTrailingPathParts, dir)
- Source:
Programatically define a route, rather than using api.config.routes. This is useful for plugins which may define routes as well.
You can use both api.routes.registerRoute and api.config.routes in the same project.
Parameters:
| Name | Type | Description |
|---|---|---|
method |
string | HTTP verb (get, put, etc) |
path |
string | The route in question. Can use variables. |
action |
string | The action to call with this route. |
apiVersion |
Number | The version of the action to call, if more than one. |
matchTrailingPathParts |
Boolean | Allows the final segment of your route to absorb all trailing path parts in a matched variable. (ie: /api/user would match /api/user/123) |
dir |
string | Which folder to serve static files from (must by included in api.config.general.paths) |