Is it possible to see the response of a API call from Mirage JS in browser without calling it from code?

221 Views Asked by At

Here is the server creation :

import { createServer } from "miragejs"

export default function () {
  createServer({
    routes() {
      this.get("/api/reminders", () => ({
        reminders: [
            { id: 1, text: "Walk the dog" },
            { id: 2, text: "Take out the trash" },
            { id: 3, text: "Work out" },
          ],
      }))
    },
  })
}
Footer

https://github.com/sultanshaik/MirageBrowserTest/blob/main/mirage-tutorial/src/server.js

I am able to see the response when I make the call from code.

https://github.com/sultanshaik/MirageBrowserTest/blob/main/mirage-tutorial/src/components/Reminders.js

I am trying to see if it is possible to make a get request in Mirage JS using the browser.I wanted to know if it is possible to see the same by visiting "https://localhost:3000//api/reminders". I don't see the route directly.What am I doing wrong?

0

There are 0 best solutions below