Is it preferable to use two package.json for frontend and backend?
How would you hook up Express, and React with one Package.json?
And if you were to set up react from scratch. Not using create-react-app but setting up webpack?
Why do you want to use a single package.json for both frontend and backend?
IMO You should always make your apps i.e. Frontend and Backend decoupled from each other as much as possible which I always do. I personally don't have any reason to use single package.json for both and never really tried.
Closest thing that I have done is that after building react app. I served the static build from the express server.
Ummm.. Setting up react from scratch with webpack, I will pass.
Can you show how can someone serve the static build from express server.
In some automatic way (not just copy/paste the build folder in the public folder of express)
I was just wondering what common practice is. And, how to set it up if you were only using a single package.json.
I'm working on a project with a buddy; They prefer not to use create react app. Because it's "bloated".
All examples i've seen have like you said Frontend and Backend decoupled from each other.
Is it preferable to use two package.json for frontend and backend?
How would you hook up Express, and React with one Package.json?
And if you were to set up react from scratch. Not using create-react-app but setting up webpack?
Why do you want to use a single package.json for both frontend and backend?
IMO You should always make your apps i.e. Frontend and Backend decoupled from each other as much as possible which I always do. I personally don't have any reason to use single package.json for both and never really tried.
Closest thing that I have done is that after building react app. I served the static build from the express server.
Ummm.. Setting up react from scratch with webpack, I will pass.
Hope this helps. :-)
Can you show how can someone serve the static build from express server.
In some automatic way (not just copy/paste the build folder in the public folder of express)
You do need to serve the static build from the server.
Just serve the build files when
NODE_ENV==="production"
The automatic part is that the copy/paste part will be handled by your docker image.
I was just wondering what common practice is. And, how to set it up if you were only using a single package.json.
I'm working on a project with a buddy; They prefer not to use create react app. Because it's "bloated".
All examples i've seen have like you said Frontend and Backend decoupled from each other.
Thanks for the reply!
IMO, create-react-app is not bloated. It's a production ready environment. But, thats a whole another discussion.
And, most developers prefers a decoupled setup. If you want a decoupled setup, then just look into yarn workspaces.
It's preferable so you can separate your client-side packages from the server-side ones. It's more organized.