Optional
aliasesOptional
authenticationTo 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
authorizationYou 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
corsCross-origin resource sharing configuration (using module cors)
{
// Configures the Access-Control-Allow-Origin CORS header.
origin: "*", // ["http://localhost:3000", "https://localhost:4000"],
// Configures the Access-Control-Allow-Methods CORS header.
methods: ["GET", "OPTIONS", "POST", "PUT", "DELETE"],
// Configures the Access-Control-Allow-Headers CORS header.
allowedHeaders: [],
// Configures the Access-Control-Expose-Headers CORS header.
exposedHeaders: [],
// Configures the Access-Control-Allow-Credentials CORS header.
credentials: false,
// Configures the Access-Control-Max-Age CORS header.
maxAge: 3600
}
https://moleculer.services/docs/0.14/moleculer-web.html#CORS-headers
Optional
debounceDebounce wait time before call to regenerated aliases when got event "$services.changed"
500
Optional
etagThe etag option value can be false
, true
, weak
, strong
, or a custom Function
Optional
loggingEnable/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
nameFrom 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.
Optional
onYou can add route-level & global-level custom error handlers.
In handlers, you must call the res.end
. Otherwise, the request is unhandled.
Optional
openapiPath prefix to this route
Optional
rateThe Moleculer-Web has a built-in rate limiter with a memory store.
Optional
useIt supports Connect-like middlewares in global-level, route-level & alias-level.
Signature: function (req, res, next) {...}.
Signature: function (err, req, res, next) {...}.
For more info check express middleware
Optional
whitelistIf 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).