title: Cannot access 'user' before initialization
body: <p>I am new in Mern development, and getting this &quot;Cannot access 'user' before initialization&quot; error in controller file</p>
  <p>Controller/user.js</p>
  <pre><code>const user = require('../models/user')
  exports.signup = (req,res)=&gt;{
     console.log('req.body', req.body);
    const user = new user(req.body);
    user.save((err, user)=&gt;{    
  if(err){
      return res.status(400).json({
          err
      })
  }
  res.json({
      user
  })
    })
  }
  </code></pre>
  <p>Route/user.js</p>
  <pre><code>const express = require('express');
  const router = express.Router();
  
  const {signup} = require('../controllers/user');
  
  router.post(&quot;/signup&quot;, signup);
  module.exports = router;
  </code></pre>