Replies: 1 comment
-
Ideally, if you use orval with msw , it is merely a question of whether you should start msw to intercept your requests.In the starting script of your app, you could make something like this: import { setupWorker } from 'msw/browser'
...
async function startMsw () {
// Dynamic import, since we don't want this in production. Omit if you have no custom request handlers.
// use require(...) if you are in a Node.js environment
const { handlers } = await import('path-to-your-handlers")
const mockWorker = setupWorker(...handlers)
await mockWorker.start()
}
if (process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test') {
startMsw()
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is there an option or some way to add the check for NODE_ENV and based on that mock data or do a real request?
example:
This is what I get when I generate the endpoints:
So what I'm asking is it possible to get something like this:
Beta Was this translation helpful? Give feedback.
All reactions