Open johncowen opened 10 months ago
This issue was inactive for 90 days. It will be reviewed in the next triage meeting and might be closed. If you think this issue is still relevant, please comment on it or attend the next triage meeting.
This issue was inactive for 90 days. It will be reviewed in the next triage meeting and might be closed. If you think this issue is still relevant, please comment on it or attend the next triage meeting.
This issue was inactive for 90 days. It will be reviewed in the next triage meeting and might be closed. If you think this issue is still relevant, please comment on it or attend the next triage meeting.
Description
Everytime I add new mocks that are slightly more involved, I wish I could just navigate to the API endpoint in my browser and view the response so I can see what is happening.
Currently we can't do this because we use MSW so you have to go to a page in the GUI that you know makes the HTTP request you are building out and view the response in web inspector. If this is a new response that doesn't have any code in the GUI to request it yet, then you have to build this out first.
Vite supports serving up other files other than our HTML and JS files, and I think (from what I remember) it allows you to add middlewares for specific endpoints. We should be able to repurpose our existing mock utility functions to make a middleware for Vite also, just like we do to run them via Cypress. (also I originally had our mocks running in an express server before bringing them to MSW). This would allow us to just navigate to the URL of the API endpoint you are building and see the response.
Whilst it doesn't have to be done here, if you have this running we may aswell not use MSW during local development work and only use it for the PR previews.
Decided to make an issue for this rather than run off and find the express code I had and move it to Vite or just think "I'll do it next time I'm building out an endpoint" which never happens 😆