OptionalaliasesOptionalauthenticationTo 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.OptionalauthorizationYou 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.OptionalautoThe 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.
And blacklist parameter to specify services that the Gateway should not track and build the routes.
OptionalblacklistIf you don’t want to publish all actions, you can filter them with blacklist 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
OptionalbodyParse incoming request bodies, available under the ctx.params property
OptionalbusboyAPI 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.
OptionalcallThe route has a callOptions property which is passed to broker.call. So you can set timeout, retries or fallbackResponse options for routes.
OptionalcamelIf alias handler not found, api will try to call service by action name
This option will convert request url to camelCase before call action
OptionalcorsCross-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
}
OptionaldebounceDebounce wait time before call to regenerated aliases when got event "$services.changed"
OptionaletagThe etag option value can be false, true, weak, strong, or a custom Function
OptionalloggingEnable/disable logging
OptionalmappingThe 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.
OptionalmergeTo disable parameter merging set mergeParams: false in route settings.
Default is true
OptionalnameFrom v0.10.2
Support multiple routes with the same path.
You should give a unique name for the routes if they have same path.
OptionalonYou could manipulate the data in onAfterCall.
Must always return the new or original data.
OptionalonThe route has before & after call hooks. You can use it to set ctx.meta, access req.headers or modify the response data.
OptionalonYou can add route-level & global-level custom error handlers.
In handlers, you must call the res.end. Otherwise, the request is unhandled.
OptionalopenapiPath prefix to this route
OptionalrateThe Moleculer-Web has a built-in rate limiter with a memory store.
OptionaluseIt 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
OptionalwhitelistIf 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).