2023-10-15 23:26:27 +02:00
|
|
|
import { createServer } from 'miragejs';
|
|
|
|
|
|
|
|
export default function (config) {
|
|
|
|
const finalConfig = {
|
|
|
|
...config,
|
|
|
|
routes,
|
|
|
|
};
|
|
|
|
|
|
|
|
return createServer(finalConfig);
|
|
|
|
}
|
|
|
|
|
|
|
|
function routes() {
|
2023-10-23 17:33:25 +02:00
|
|
|
this.logging = true;
|
2023-10-15 20:37:03 +02:00
|
|
|
this.namespace = '/api/index.php'; // make this `api`, for example, if your API is namespaced
|
|
|
|
this.timing = 400; // delay for each request, automatically set to 0 during testing
|
2016-12-19 17:04:09 +01:00
|
|
|
|
|
|
|
this.get('/polls/:id');
|
|
|
|
this.post('/polls');
|
|
|
|
this.post('/users');
|
|
|
|
}
|