Optional
aliases?: { Optional
authentication?: boolean | stringTo enable the support for authentication, you need to do something similar to what is describe in the Authorization paragraph.
Also in this case you have to:
authentication: true
in your routesctx.meta.user
property. You can use it in your actions to get the logged in user entity.
From v0.10.3
: You can define custom authentication
and authorization
methods for every routes.
In this case you should set the method name
instead of true
value.Optional
authorization?: boolean | stringYou can implement authorization. Do 2 things to enable it.
From v0.10.3
: You can define custom authentication
and authorization
methods for every routes.
In this case you should set the method name
instead of true
value.Optional
autoThe auto-alias feature allows you to declare your route alias directly in your services.
The gateway will dynamically build the full routes from service schema.
Gateway will regenerate the routes every time a service joins or leaves the network.
Use whitelist
parameter to specify services that the Gateway should track and build the routes.
Optional
bodyParse incoming request bodies, available under the ctx.params
property
Optional
busboyAPI Gateway has implemented file uploads.
You can upload files as a multipart form data (thanks to busboy library) or as a raw request body.
In both cases, the file is transferred to an action as a Stream.
In multipart form data mode you can upload multiple files, as well.
Please note
: you have to disable other body parsers in order to accept files.
Optional
callThe route has a callOptions property which is passed to broker.call. So you can set timeout, retries or fallbackResponse options for routes.
Optional
camelIf alias handler not found, api
will try to call service by action name
This option will convert request url to camelCase before call action
`/math/sum-all` => `math.sumAll`
@default: null
Optional
debounceDebounce wait time before call to regenerated aliases when got event "$services.changed"
500
Optional
logging?: booleanEnable/disable logging
true
Optional
mappingThe route has a mappingPolicy
property to handle routes without aliases.
Available options:
all
- enable to request all routes with or without aliases (default)
restrict
- enable to request only the routes with aliases.
Optional
mergeTo disable parameter merging set mergeParams: false
in route settings.
Default is true
Optional
name?: stringFrom v0.10.2
Support multiple routes with the same path.
You should give a unique name for the routes if they have same path.
Optional
onYou could manipulate the data in onAfterCall
.
Must always return the new or original data
.
Optional
onThe route has before & after call hooks. You can use it to set ctx.meta
, access req.headers
or modify the response data.
Path prefix to this route
Optional
whitelist?: (string | RegExp)[]If you don’t want to publish all actions, you can filter them with whitelist option.
Use match strings or regexp in list. To enable all actions, use "**" item.
"posts.*": Access any actions in 'posts' service
"users.list": Access call only the 'users.list' action
/^math.\w+$/: Access any actions in 'math' service
You can use alias names instead of action names. You can also specify the method. Otherwise it will handle every method types.
Using named parameters in aliases is possible. Named parameters are defined by prefixing a colon to the parameter name (:name).