mirror of
https://github.com/kevin-DL/comedy-video-lib.git
synced 2026-01-21 15:05:07 +00:00
Installing MirageJS
- Added axios configuration - Added miragejs to mock api calls
This commit is contained in:
23
plugins/mirage.js
Normal file
23
plugins/mirage.js
Normal file
@@ -0,0 +1,23 @@
|
||||
import { createServer } from 'miragejs'
|
||||
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
startServer(0)
|
||||
}
|
||||
|
||||
function startServer() {
|
||||
createServer({
|
||||
routes() {
|
||||
this.namespace = 'api'
|
||||
|
||||
this.get('/movies', () => {
|
||||
return {
|
||||
movies: [
|
||||
{ id: 1, name: 'Inception', year: 2010 },
|
||||
{ id: 2, name: 'Interstellar', year: 2014 },
|
||||
{ id: 3, name: 'Dunkirk', year: 2017 },
|
||||
],
|
||||
}
|
||||
})
|
||||
},
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user