ERROR app.use() requires middleware functions: (so how to set router for app.use in express node.js)?
<p>basically im just trying to seprate routes, models, and controller in node.js application.
i have following files to setup very very basic node.js application.</p>

<p>controller/cv.js</p>

<pre><code>module.exports = {

   get: function(req, res, next){
        console.log("GET REQUESTS")
        next();
    }
}
</code></pre>

<p>routes/cv.js</p>

<pre><code>var express = require('express');
var CvRouter = express.Router();
var CvController = require('../controller/cv')


CvRouter.get('/', function(req, res, next){
        console.log("GET REQUESTS")
        next();
    })

module.export = CvRouter
</code></pre>

<p>app.js</p>

<pre><code>const express = require('express');
const bodyParser= require('body-parser')
var path = require('path')

const app = express();

app.use(bodyParser.urlencoded({extended: true}))
app.use(bodyParser.json())

 var router = express.Router();
 require('./router')(app)



app.listen(3000, function() {
  console.log('listening on 3000')
})
</code></pre>

<p>router.js</p>

<pre><code>var CvRouter = require('./routes/cv')


module.exports = function(app) {
    app.use([CvRouter]);
};
</code></pre>

<p>Basicaly this last file router.js is generting error when i use app.use([CvRouter])
ERROR is:  <strong>throw new TypeError('app.use() requires middleware functions');</strong></p>

<p>how i can resolve it? i also know its returning object of router. and app.use expecting function in parameter. but how i can achieve my desired MVC pattern of node.js?</p>