refresh-token-postgraphile
refresh-token-postgraphile copied to clipboard
Use webpack dev server instead of a custom proxy
Thank you for the great example. I was looking for such a solution for quite some time!
I wanted to propose an improvement to how client/server are run in development. This changes reverts the responsibility of which is doing proxying on behalf of the client to avoid CORS (in the development setup). To me it makes more sense to have proxying done by the client part as webpack dev server supports that feature out of the box. It has several advantages, I think:
- The backend does not need to care of proxying requests for the frontend
- In the client the urls to the backend are not full URLs (http://localhost:4000/path) only absolute URLs (/path). It shows in the changes I did in Apollo.js and in useAuth.js.
- In my experience, this setup ressembles more the target production installation where the frontend would served statically by an nginx or Apache server, in addition to having a reverse proxy or a load balancer to provide access to the backend. All are served from the same origin.
Thanks in advance for considering merging this PR.