Optional
assetsOptional
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
etagThe etag option value can be false
, true
, weak
, strong
, or a custom Function
Optional
http2Use HTTP2 server (experimental)
false
Optional
httpHTTP Server Timeout
null
Optional
internalSpecial char for internal services
Note: RegExp
type is not official
"~"
"~" => /~node/~action => /$node/~action
/[0-9]+/g => /01234demo/hello2021 => /demo/hello `(not official)`
Optional
ipExposed IP
process.env.IP || "0.0.0.0"
Optional
log4XXResponsesIf set to true, it will log 4xx client errors, as well
false
Optional
logLog each request (default to "info" level)
"info"
Optional
logLog the request ctx.params (default to "debug" level)
"debug"
Optional
logLog each response (default to "info" level)
"info"
Optional
logLog the response data (default to disable)
null
Optional
logLog the route registration/aliases related activity
"info"
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
openapiOptional
optimizeOptimize route order
true
Optional
pathGlobal path prefix
Optional
portExposed port
process.env.PORT || 3000
Optional
qsOptions passed on to qs
Optional
rateThe Moleculer-Web has a built-in rate limiter with a memory store.
Optional
rootCallOption for the root action api.rest
null
Optional
routesOptional
serverUsed server instance. If null, it will create a new HTTP(s)(2) server
If false, it will start without server in middleware mode
true
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
It serves assets with the serve-static module like ExpressJS.