Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In this pull request, we change the code not to use proxy in the dev environment and also prepare it to run on separate API / static servers with different URLs - and support for
cors
.We follow the article: How to Set up CORS and Cookie-Session in Express
Here are the main changes we've made.
On the backend
cookie-session
to support calls from different origins and also have two other behaviors - for dev and productionhttps://github.com/remult/react-vite-express-starter/compare/completed-tutorial...cross-origin?expand=1#diff-e4e7a68d82cdfba4e7dab9a32a8f55f3806ffa0cf33f1b8ab64b42941cf68888R13-R38
On the frontend
vite.config.ts
file.API_URL
and used it throughout the code..env.production
that will include the URL of the actual server once the app is deployed.