title: Making a API for currentUser in MEAN
body: <p>I am using JWT for authenticating a user. I have wrote some functions for getting the current user which is working fine but I need to make that functions as API so that, It can be called from anywhere.</p>
  
  <p><strong>token-service.service.ts</strong></p>
  
  <pre><code>  currentUser(): { _id: string; username: string; role: string; email: string } {
      return this.jwtHelper.decodeToken(this.authToken()).user;
    }
  
    authToken() {
      return localStorage.getItem('token');
    }
  
    setToken(token) {
      localStorage.setItem('token', token);
    }
  
    clearToken() {
      localStorage.removeItem('token');
    }
  </code></pre>
  
  <p><strong>auth.service.ts</strong></p>
  
  <pre><code> get currentUser(): { _id: string; username: string; role: string; email: string } {
      return this.tokenService.currentUser();
    }
  
    get loggedIn(): boolean {
      return this.tokenService.loggedIn();
    }
  </code></pre>
  
  <p>I want to make currentUser As a API GET method. Because It has to be called from another machine.</p>