Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How I can bypass "angular-in-memory-web-api" for a specific url

I was using "angular-in-memory-web-api" to mock my REST web api, however now I am have started writing the actual web api and I want to replace the "angular-in-memory-web-api" step by step.

Example: I have written following asp.net web api /api/values however when I issue http.get() request using above api url angular tries to serve it using "angular-in-memory-web-api", however in this case I want to bypass "angular-in-memory-web-api" so that request is entertained by my actual web api controller.

like image 787
Shaukat Mahmood Ahmad Avatar asked Dec 10 '16 13:12

Shaukat Mahmood Ahmad


2 Answers

you can set passThruUnknownUrl to forward to real backend for un-matching endpoints

e.g.,

InMemoryWebApiModule.forRoot(InMemoryDataService, {
  passThruUnknownUrl: true
}),
like image 175
xmlking Avatar answered Sep 29 '22 05:09

xmlking


You can try by removing InMemoryWebApiModule.forRoot(InMemoryDataService) from your app.module. If you have done so already, showing some code would be helpful.

Also, consider using Postman to verify your new service

like image 27
Juan Herrera Avatar answered Sep 29 '22 04:09

Juan Herrera