App upload to Github Pages #997
-
Hi, I created my react app with msw and I uploaded it on github pages. When the data should be fetched I get 405 error, however it's working on localhost. I'm not sure if it's my fault or it's just not possible to host app with msw. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi, @lukbar48. You get 405 from GitHub because POST requests are forbidden against GitHub pages. When you open the browser's console and refresh the page, there's no |
Beta Was this translation helpful? Give feedback.
Hi, @lukbar48.
You get 405 from GitHub because POST requests are forbidden against GitHub pages.
When you open the browser's console and refresh the page, there's no
[MSW] Mocking enabled
message displayed. That's a straight sign that MSW is not included in your application. If you go to yoursrc/index.tsx
, you can see the exact condition that excludes it. MSW is, generally, a development tool, that's why most resources online recommend including it only when developing. If I understand your use case correctly, you wish to have MSW as a server replacement for your application in production. In that case, remove theif
condition that checksprocess.env.NODE_ENV
and the library will be incl…