title: ES6 Router.use() requires a middleware function but got a Object
body: <p>Now I worked with Node.js + Express to make some api server.</p>
  
  <p>I installed <code>babel-preset-latest</code> to use ES6 statement.</p>
  
  <p>However, When I write some code, it throws error -></p>
  
  <p><code>Router.use() requires a middleware function but got a Object</code></p>
  
  <p>[index.js]</p>
  
  <pre><code>import express from 'express';
  import bodyParser from 'body-parser';
  
  const app = express();
  app.use(bodyParser.json());
  app.use(bodyParser.urlencoded({ extended: true }));
  
  app.get('/', (req, res) =&gt; {
      res.send('main');
  });
  app.use('/api', require('./api/auth'));
  
  app.listen(3000, () =&gt; {
      console.log("Express Running port 3000")
  })
  </code></pre>
  
  <p>[/api/auth/index.js]</p>
  
  <pre><code>import express from 'express';
  const router = express.Router();
  
  
  router.get('/', (res, req) =&gt; {
      res.send('auth main')
  });
  
  export default router;
  </code></pre>
  
  <p>In ES6, <code>module.export</code> can replace to <code>export</code>.</p>
  
  <p>But it throw errors. So, after I replace <code>export default router;</code> to <code>module.exports = router;</code>, It works perfectly.</p>
  
  <p>Why do I get this error? Is there any syntax error?</p>
  
  <p>Thanks.</p>