◐ Shell
clean mode source ↗

Allowing using middleware config in dev server options

Command

serve

Description

Dev server middleware configuration is very commonly used in development,such as auto login or log printing,but it is not currently supported。

Describe the solution you'd like

Refer to the implementation of proxyConfig, add the middlewareConfig configuration to angular.json -> server -> options, and parse and inject the middleware in angular/build.
middlewareConfig supports configuring a js file path, and the file exports a single middleware function or an array of multipe middleware functions. such as:

function log(req, res, next) {
    next()
}

module.exports  = log;
function log(req, res, next) {
    next()
}

function auth(req, res, next) {
    next()
}

module.exports =
    [
        log,
        auth,
    ]

Describe alternatives you've considered

No response