I am following [this](http://jasonwatmore.com/post/2018/05/23/angular-6-jwt-authentication-example-tutorial) article. The author is using `fake-backend.ts` to intercept an api call whose url ends with `/api/authenticate` and check users based on their username and password from a static array.

When the user submit form with username and password then it calls `authentication.service.ts` login function which post call on path `/api/authenticate` and as the call has an url ending with `/api/authenticate` so now here `fake-backend.ts` comes into play which is validating user from static array. After successful authentication it generates a token and control goes back to `authentication.service.ts` to map response object

I bit change this `fake-backend.ts` with calling an api to validate users from db. But I am getting below error.

> 
> Http failure response for <https://localhost:44348/api/authenticate>:
>  404 OK
> 
> 
> 

Also call not going back to `authentication.service.ts` to map response object.

```
if (request.url.endsWith('/api/authenticate') && request.method === 'POST') {
const UserName = request.body.username;
const Password = request.body.password;
var credentials = { UserName, Password };
//return this.employeeService.autheticateEmployeeByCredentials(credentials);
this.employeeService.autheticateEmployeeByCredentials(credentials).subscribe((res) => {
if (res == 1) 
    return of(new HttpResponse({ status: 200, body: { token: 'fake-jwt-token' } }));    
else 
      return throwError({ error: { message: 'Username or password is incorrect' } });   
  });
}   

```

**Edit :**  

I am using an api controller and validating from that returning 1 if its there in db else 0. Also getting response from api but control does not do back to authentication.service.ts but goes to `login.component.ts` subscribe and throws this error.