Ghost/ghost/admin/mirage/routes-dev.js
Kevin Ansfield 5544389b80 Fixed "The routes only function has been deprecated" output in test runs
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
2022-05-25 11:03:05 +01:00

26 lines
1.0 KiB
JavaScript

import ghostPaths from 'ghost-admin/utils/ghost-paths';
export default function () {
// allow any local requests outside of the namespace (configured below) to hit the real server
// _must_ be called before the namespace property is set
this.passthrough('/ghost/assets/**');
this.namespace = ghostPaths().apiRoot;
this.timing = 1000; // delay for each request, automatically set to 0 during testing
this.logging = true;
// Mock endpoints here to override real API requests during development, eg...
// this.put('/posts/:id/', versionMismatchResponse);
// mockTags(this);
// this.loadFixtures('settings');
// keep this line, it allows all other API requests to hit the real server
this.passthrough();
// add any external domains to make sure those get passed through too
this.passthrough('http://www.gravatar.com/**');
this.passthrough('https://cdn.jsdelivr.net/**');
this.passthrough('https://api.unsplash.com/**');
this.passthrough('https://ghost.org/**');
}