Hi all, somewhat of a noob with Express, running into something that works on Windows but doesn’t work with Linux.
I’m using a middleware (req, res, next) and I’m passing next into a subroutine, like this:
app.use (req, res, next)
{
// … some code
subroutine(req, res, next);
return;
}
subroutine = async function(req, res, next)
{
// some more code
next();
}
The idea is, I don’t want to execute next() till the subroutine is finished.
This works great on Windows, I’m using the Docker desktop and the code works perfectly with no complaints.
On Linux in the cloud, this doesn’t work, it results in a “next is not a function” error.
Firstly, am I doing this the right way? What other method(s) could I use to do this?
And second, who’s doing the type checking here? I’m not using TypeScript, don’t know where this type checking is coming from. ls there a way I can tell Node/Express that “this is a function, don’t complain” ? Is there a way to override the type checking?
Thanks for your help and input!