angular / in-memory-web-api

The code for this project has moved to the angular/angular repo. This repo is now archived.
MIT License
1.18k stars 232 forks source link

Programmatically switch off API #124

Closed daniel-seitz closed 7 years ago

daniel-seitz commented 7 years ago

What I would like to do is check certain conditions when an call is made and based on those either pass the request to the in memory web api, or pass this request to a real backend api.

The request would be the same, let's say 'api/user/1' gives me info of user 1.

When the user is not logged in, I'd like to have the in-memory-web-api handle the request, when the user is logged in then the real backend should process it.

A solution could be to add the option 'disable' (default: false) to InMemoryBackendConfigArgs and add the relevant logic to the code.

wardbell commented 7 years ago

I don't think that would work because configuration happens once. I'm also reluctant to add more and more switches for rare corner cases.

I also don't understand why you want this feature. You never want the in-mem web api in production.

You can handle this yourself I suspect by creating your own subclass or wrapper of the in-mem web api.

While I appreciate your affection for this library, I'm afraid I'll have to close this issue because I have no intention of acting on it. Sorry.