I’m just beginning the Build a Voting App challenge in the Back End Development projects and I’m having a lot of difficulty figuring how to use Express with create-react-app. The goal I have in mind is for express to serve the React app when I run npm start.
If you look at the app.js file https://github.com/JohnnyBizzel/voting-app/blob/no-auth0/app.js
I have set up routing so index goes to the React index file.
/api goes to any API calls
/user is not currently used
and the other 2 routes are use for refreshes of these routes.
We also used React Routing.
More routing code is found here in index.js:
That’s not using “Create React App” but I hope this info helps.
I used React-Router for the user accessible pages (public facing) and Express for the backend API. I ended up using a proxy and essentially running two concurrent processes, as detailed here: