Router.use() requires a middleware function but got undefined

Change all of these:

var registrationRouter = require('./routes/registration-route').default;

to remove the .default so you just have this:

const registrationRouter = require('./routes/registration-route');

.default is something that is used with ESM modules, not with CommonJS modules.


Also, you shouldn't be using var any more. It's obsolute now. Use const for these.