Thanks for your answer! So I followed the steps and I got this error :
TypeError('Router.use() requires a middleware function but got a ' +
gettype(fn))
^
TypeError: Router.use() requires a middleware function but got a Object
It comes from the module.exports which doesn't like multiples v
In index.js you are not exporting the connection object, you are only exporting
router object. That is why you are getting the error when you reference
connection object in booksModel.js. You could try the following:
Step 1: In index.js include connection in the module exports as below:
module.ex
Hi, I am trying to build an MVC model API. I'm having troubles making
queries. It seems like I don't export my connection variable correctly,
cause I've got a "connection.query is not a function" error.
I've tried to export it using exports.module but as I already have router
to export, I had