Optional
cors?: CorsOptions{
// 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
etag?: boolean | "weak" | "strong" | ETagFunctionThe etag option value can be false
, true
, weak
, strong
, or a custom Function
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
rateThe Moleculer-Web has a built-in rate limiter with a memory store.
Optional
use?: (routeMiddleware | routeMiddlewareError)[]It 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
Cross-origin resource sharing configuration (using module cors)