Skip to content

Accept default express parameters in middleware function. #8428

@RahulLanjewar93

Description

@RahulLanjewar93

Issue Checklist

Issue

Currently, the middleware function does not accept the express default parameters

/* middleware for express server, can be string or function */
middleware: ?((() => void) | string);

However, the middleware is directly supplied to express in

if (options.middleware) {
let middleware;
if (typeof options.middleware == 'string') {
middleware = require(path.resolve(process.cwd(), options.middleware));
} else {
middleware = options.middleware; // use as-is let express fail
}
app.use(middleware);
}

So we should be able to pass req,res,next parameters

Actual Outcome

Not able to pass the default express parameters req,res,next to the middleware function

Expected Outcome

Should be able to pass req,res,next parameters

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:featureNew feature or improvement of existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions