|
1 | 1 | # Server configuration
|
2 | 2 |
|
3 |
| -The MirageJS server is configured for you by ember-cli-mirage. However, if you |
4 |
| -need to customize the server you can by creating a makeServer function in the |
5 |
| -config.js. |
6 |
| - |
7 |
| -Typically, the `/mirage/config.js` file contains a single default export which |
8 |
| -is a function defining all your Mirage route handlers. Ember CLI Mirage then |
9 |
| -uses this function, along with all the other modules you've defined in |
10 |
| -`mirage/models`, `mirage/fixtures`, `mirage/factories`, and |
11 |
| -`mirage/serializers`, to create your Mirage JS server when your app boots up |
12 |
| -in development and testing. |
13 |
| - |
14 |
| -You can now opt in to having more control over exactly how your Mirage server |
15 |
| -is instantiated using the same code as the mirageJS examples of creating a server |
16 |
| -by changing your current default export that represents the routes to a normal function, |
17 |
| -then creating a new default export function that creates the mirageJS server. |
18 |
| - |
19 |
| -This new default export function receives a single argument named `config`, |
| 3 | +The MirageJS server used to be configured for you by ember-cli-mirage. This has been |
| 4 | +deprecated in favor of configuring the server similar to MirageJS. |
| 5 | + |
| 6 | +Typically, the `/mirage/config.js` file contains a default export (no |
| 7 | +parameters) which |
| 8 | +is a function defining all your Mirage route handlers. |
| 9 | + |
| 10 | +This new default export function receives a single argument usually named `config`, |
20 | 11 | which contains all the factory/fixture/serializer/model modules that exist
|
21 | 12 | in your project's `/mirage` directory. This saves you from having to import
|
22 | 13 | each module explicitly and then pass it into your Mirage server, just like
|
@@ -47,9 +38,9 @@ independently of `ember-cli-mirage`.
|
47 | 38 |
|
48 | 39 | All the objects from `miragejs` are re-exported in `ember-cli-mirage` such as
|
49 | 40 | `Model`, `belongsTo`, `hasMany` as well as `Fixtures`, `Traits` for example.
|
50 |
| -These should in the future also be imported directly from `miragejs` as |
51 |
| -eventually these re-exports will be removed. This will help align the |
52 |
| -`ember-cli-mirage` users with the rest of the Mirage JS community. |
| 41 | +These have also been deprecated and you should import directly from `miragejs`. |
| 42 | +This will help align the `ember-cli-mirage` users with the rest of the |
| 43 | +Mirage JS community. |
53 | 44 |
|
54 | 45 | ```javascript
|
55 | 46 | // Example with inline routes
|
|
0 commit comments