Optional
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
}
Optional
etagThe 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
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
Cross-origin resource sharing configuration (using module cors)