mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 05:37:34 +03:00
5544389b80
no issue `ember-cli-mirage` replaced the use of a default function export with a `createServer` function that applies config and deprecated the older mirage config export style. It will also soon drop support of the separate `testConfig` export we used for defining our test routes. - switched to the newer `return createServer(config);` server configuration approach - extracted dev and test routes into separate files for a cleaner base config
27 lines
737 B
JavaScript
27 lines
737 B
JavaScript
/* eslint-disable ghost/ember/no-test-import-export */
|
|
import {applyEmberDataSerializers, discoverEmberDataModels} from 'ember-cli-mirage';
|
|
import {createServer} from 'miragejs';
|
|
import {isTesting, macroCondition} from '@embroider/macros';
|
|
|
|
import devRoutes from './routes-dev';
|
|
import testRoutes from './routes-test';
|
|
|
|
export default function (config) {
|
|
let finalConfig = {
|
|
...config,
|
|
models: {...discoverEmberDataModels(), ...config.models},
|
|
serializers: applyEmberDataSerializers(config.serializers),
|
|
routes
|
|
};
|
|
|
|
return createServer(finalConfig);
|
|
}
|
|
|
|
function routes() {
|
|
if (macroCondition(isTesting())) {
|
|
testRoutes.call(this);
|
|
} else {
|
|
devRoutes.call(this);
|
|
}
|
|
}
|