I want to merge two projects: one for the React frontend and the other for the NodeJs Express backend. I am using Android Studio to preview my front-end application on a phone emulator. I am not sure if you have any ideas on how I can get everything to work together.
I started by copying the front-end project and putting it at the root of the back-end project. Then, I set up a variable in the package.json file to be able to start the front-end from the back-end ("client": "cd my_frontend_project && npm start"). As for the next steps, I’m lost and I really don’t know what to do.
Should I create a single file to start this connection, or several, knowing that my project comprises several pages/functionalities, and how do I set up this connection?
2
Answers
to understand all of your code how the flow works inside some the functions try to write consoles for example: console.log("auth-middleware") ,
console.log("error handler")
first of all start both of them Frontend and Backend
second check the port number that they are running
so in backend (Nodejs)
in index.js (the file that start the server)
try to set up the cors like this: