title: make url without id in the End in NodeJs
body: <p>I have this code for the login process, and the payload in the jwt contains an id and an email
  and this is the code :</p>
  <p>employeeController:</p>
  <pre><code>/**
  *
  * @param req
  * @param res
  * @return {Promise&lt;*&gt;}
  * @private
  */
  const _login = async (req, res) =&gt; {
        const loginResponse = await EmployeeService.Instance.login(req.body['employee']);
        const responseCode = PCODES.getResponseCode(loginResponse.code);
        res.status(responseCode).json(loginResponse);
  };
  </code></pre>
  <p>EmployeeServices.js:</p>
  <pre><code>/**
   * @param {Object} payload to generate token upon
   * @return {Promise&lt;string&gt;} token base64 string
   * @description token will be expired in 10s
   */
  static _generateTokenAsync = (payload) =&gt; {
      return new Promise((resolve, reject) =&gt; {
          jwt.sign(payload, process.env.JWTSECRETKey,
              {
                  expiresIn: 3600
              }, (err, token) =&gt; {
                  if (err) {
                      reject(err);
                  } else {
                      resolve(token);
                  }
              });
              console.log(payload);
      });
  };
  
  
  /**
   *
   * @param employee
   * @return {Promise&lt;null|Object&gt;}
   */
  async login(employee) {
      if (employee === null || employee === undefined) return {
          message: 'Missing data',
          employee: employee,
          code: PCODES.MISSING_DATA
      };
  
      const {email, password} = employee;
  
      if (email === undefined || password === undefined) {
          return {message: 'Missing data', employee: employee, code: PCODES.MISSING_DATA};
      }
      return await EmployeeModel.findOne({
          where: {
              email: email
          },
          include: [
              {
                  as: 'EmployeeRoles',
                  model: EmployeeRoleModel,
                  attributes: ['roleId', 'targetId', 'employeeId'],
                  /*through: {
                      model: EmployeeRoleModel,
                      attributes: ['roleId', 'targetId', 'employeeId' ]
                  }*/
              }
          ],
          attributes: [
              'id', 'name', 'email', 'password'
          ]
      })
          .then(async (employee) =&gt; {
              if (!employee) {
                  return {message: 'Employee does not exist', email: email, code: PCODES.FAILED};
              }
              const passwordIsValid = bcrypt.compareSync(password.toString(), employee.password);
              if (!passwordIsValid) {
                  console.log('Password don\'t match');
                  return {
                      message: 'Password don\'t match',
                      email: email,
                      password: password,
                      code: PCODES.AUTHORIZATION_FAILED
                  };
              }
              const token = await EmployeeService._generateTokenAsync({
                  id: employee.id,
                  email: employee.email
              });
              delete employee['dataValues']['password'];
              employee['dataValues']['token'] = token;
              return {
                  message: 'Login successfully', employee: employee, code: PCODES.SUCCESS
              };
          })
          .catch(dbErr =&gt; {
              console.log(dbErr);
              return {message: 'Internal server error', code: PCODES.DATABASE_ERROR};
          });
  }
  </code></pre>
  <p>The question is:
  When I want to use the id in another controller, I get it through one of the following :</p>
  <pre><code> const employee = res.locals['employee'];  or  const employeeId = req.params['id'];
  </code></pre>
  <p>The question is how can I get the id from the token without typing the id used at the end of each url like this url ,this url contains employeeId=14ll0ltgkcc5aycv  :</p>
  <pre><code>http://localhost:3001/employee/company/14ll0ltgkcc5aycv
  </code></pre>
  <p>but I don't want the id to be written at the end of the url. I want to get it from the token and have it uploaded to the payload,How can i do it ?.</p>