Create-react-app + express packaged deployment

Project directory is react

          ------------react-client       //
          ------------react-backend      //express 
          
          

now I"m going to publish it to the server. Am I npm run build separately on react-client react-backend? Besides, can I just install nodejs on my server?

the train of thought is not clear.

May.31,2021

1.express does not need to be packaged
2. Package the front-end code into the static directory of express
3.express route and write it. In the template html (usually jade or ejs), refer to the packaged js and css
4 in the static directory. Enable express port listening

Note:
1. The drinking path of the template html is the access path of the server, not the path of files and files within the project
2. Everyone may encounter problems with front-end packaging, so try to solve it


< script > pointing to http://localhost:3001/static/js/main.ceae68dd.js" failed to load. How do I specify a new js css >?

Menu