title: Get some error when splitting file in nodejs express
body: <p>The error is:  </p>
  
  <blockquote>
    <p>throw new TypeError('Router.use() requires a middleware function but
    got a ' + gettype(fn))</p>
  </blockquote>
  
  <p>The file (app.js) looks like this:</p>
  
  <pre><code>const express = require( 'express' )
  const app = express()
  const product = require( './api/routes/products')
  
  
  app.use('/products', product )
  
  
  module.exports = app;
  </code></pre>
  
  <p>And then it said in nodemon: </p>
  
  <blockquote>
    <p>throw new TypeError('Router.use() requires a middleware function but
    got a ' + gettype(fn))</p>
  </blockquote>
  
  <p>This is my file products.js:</p>
  
  <pre><code>const express = require( 'express' )
  const router = express.Router()
  
  router.get('/', ( req, res, next ) =&gt; {
    res.status( 200 ).json( {
      test: 'got it'
    } )
  })
  </code></pre>
  
  <p>Is there something missing? I use express 4.0.16.</p>