DEV Community

loading...

Discussion on: Basic Middleware Pattern in JavaScript

Collapse
muniftanjim profile image
Munif Tanjim Author • Edited

Each next function is supposed to be called only 1 time.

If you call it twice then, you get the Error('next() called multiple times') error.

Also, if you're using async middleware functions, you should always do await next().