You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+8-3Lines changed: 8 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -172,14 +172,19 @@ the in-memory backed provider supersedes the Angular version.
172
172
exportclassAppModule { ... }
173
173
```
174
174
175
-
### Examples
175
+
* The `createDb` method can be synchronous or asynchronous.
176
+
so you can initialize your in-memory database service from a JSON file.
177
+
Return the database object, an observable of that object, or a promise of that object.
178
+
The in-mem web api service calls `createDb` (a) when it handles the _first_`HttpClient` (or `Http`) request and (b) when it receives a `POST resetdb` request.
179
+
180
+
## In-memory web api examples
176
181
The tests (`src/app/*.spec.ts` files) in the [github repo](https://github.com/angular/in-memory-web-api/tree/master/src/app) are a good place to learn how to setup and use this in-memory web api library.
177
182
178
183
See also the example source code in the official Angular.io documentation such as the
179
184
[HttpClient](https://angular.io/guide/http) guide and the
180
185
[Tour of Heroes](https://angular.io/tutorial/toh-pt6).
181
186
182
-
# Bonus Features
187
+
# Advanced Features
183
188
Some features are not readily apparent in the basic usage example.
184
189
185
190
The `InMemoryBackendConfigArgs` defines a set of options. Add them as the second `forRoot` argument:
@@ -194,7 +199,7 @@ The `InMemoryBackendConfigArgs` defines a set of options. Add them as the second
194
199
This service can evaluate requests in multiple ways depending upon the configuration.
195
200
Here's how it reasons:
196
201
1. If it looks like a [command](#commands), process as a command
197
-
2. If the [HTTP method is overridden](#method-override)
202
+
2. If the [HTTP method is overridden](#method-override), try the override.
198
203
3. If the resource name (after the api base path) matches one of the configured collections, process that
199
204
4. If not but the `Config.passThruUnknownUrl` flag is `true`, try to [pass the request along to a real _XHR_](#passthru).
0 commit comments