Relative Content

Tag Archive for javascriptnode.jsexpressexpress-router

Error: Route.post() requires a callback function but got a [object Undefined] in server.js

I’m currently setting up a nodeJS server using express. I have two backend files, one is called account.js in a folder called routes and the other is called server.js. I cant get it to run because its complaining that Error: Route.post() requires a callback function but got a [object Undefined],
specifically in
const accountRoutes = require(‘./routes/account’);
app.use(‘/account’, accountRoutes);
(see in code down below:)