I know for kind of real world apps it is recommended to have the SSR in a separate server from the API.
However, many times we want to build a POC or the app is not yet big enough to deserve this separation.
In any cases I would like to achieve this. When I run this in my browser http://localhost:3000/api, browser displays cached off-line app contents from the ServiceWorker. This makes sense when it is not a API request.
How to reproduce this situation:
ran npm run build && npm run serve. Alternatively, use https://cra-ssr.herokuapp.com
load the app as per usual http://localhost:3000
access http://localhost:3000/api, you should see {} response from the API, file cra-ssr/server/routes/api.js
press F5 with the same url: Issue: browser displays the HTML cached app
If you alternate between normal reload and hard reload for the same http://localhost:3000/api you get different results each time
I understand this is not a bug in your boilerplate. I am just trying to get some help here.
Hey @leonardoanalista - I just released a new version of cra-ssr. Check it out on master. I think it should fix your issue, which I'll close unless you confirm it still needs to be addressed!
I know for kind of real world apps it is recommended to have the SSR in a separate server from the API.
However, many times we want to build a POC or the app is not yet big enough to deserve this separation.
In any cases I would like to achieve this. When I run this in my browser
http://localhost:3000/api
, browser displays cached off-line app contents from theServiceWorker
. This makes sense when it is not a API request.How to reproduce this situation:
npm run build && npm run serve
. Alternatively, usehttps://cra-ssr.herokuapp.com
http://localhost:3000
http://localhost:3000/api
, you should see{}
response from the API, filecra-ssr/server/routes/api.js
If you alternate between
normal reload
andhard reload
for the samehttp://localhost:3000/api
you get different results each timeI understand this is not a bug in your boilerplate. I am just trying to get some help here.