Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit 7488918

Browse files
committed
docs: update README
1 parent f7e216d commit 7488918

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

README.md

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,18 @@ that emulates CRUD operations over a RESTy API.
66

77
It intercepts Angular `Http` and `HttpClient` requests that would otherwise go to the remote server and redirects them to an in-memory data store that you control.
88

9-
---
9+
See [Austin McDaniel's article](https://medium.com/@amcdnl/mocking-with-angular-more-than-just-unit-testing-cbb7908c9fcc)
10+
for a quick introduction.
1011

11-
## Important recent changes
12+
### _It used to work and now it doesn't :-(_
1213

13-
### HTTP response data no longer wrapped in object w/ `data` property
14+
Perhaps you installed a new version of this library? Check the
15+
[CHANGELOG.md](https://github.com/angular/in-memory-web-api/blob/master/CHANGELOG.md)
16+
for breaking changes that may have affected your app.
1417

15-
As of v0.5.0 (5 October 2017), the `dataEncapsulation` configuration default changed from `true` to `false`. The HTTP response body holds the data values directly rather than an object that encapsulates those values, `{data: ...}`. This is a **breaking change that affects almost all existing apps!**
16-
17-
See the [CHANGELOG](https://github.com/angular/in-memory-web-api/blob/master/CHANGELOG.md/#0.5.0) for the reason behind this change and how to quickly fix your code or revert to encapsulation.
18-
19-
### v0.4 supports `HttpClient`
20-
Release v0.4.0 (8 Sept 2017) was a major overhaul of this library.
21-
22-
The v0.4.0 release introduced **breaking changes** that affect developers who used the customization features or loaded application files with SystemJS.
23-
24-
**Read this README and the [CHANGELOG](https://github.com/angular/in-memory-web-api/blob/master/CHANGELOG.md/#0.4.0)**
25-
to learn what's new and about other **breaking changes**.
26-
27-
---
18+
If that doesn't explain it, create an
19+
[issue on github](https://github.com/angular/in-memory-web-api/issues),
20+
preferably with a small repro.
2821

2922
## Use cases
3023

@@ -148,6 +141,17 @@ to ensure that the in-memory backend provider supersedes the Angular version.
148141

149142
* You can setup the in-memory web api within a lazy loaded feature module by calling the `.forFeature` method as you would `.forRoot`.
150143

144+
* In production, you want HTTP requests to go to the real server and probably have no need for the _in-memory_ provider.
145+
CLI-based apps can exclude the provider in production builds like this:
146+
```javascript
147+
imports: [
148+
HttpClientModule,
149+
environment.production ?
150+
HttpClientInMemoryWebApiModule.forRoot(InMemHeroService) : []
151+
...
152+
]
153+
```
154+
151155
### Setup for the older Angular _Http_ module
152156

153157
You can still use the in-memory web api with the older `Http` module.

0 commit comments

Comments
 (0)