So I have created a React app with
npx create-react-app my-app
and written a few functions and some content to my web app. Now I do need to implement backend for connecting to my SQL database and reading/writing from there. It is my understanding that server-side logic (NodeJS) and front-end code (React) should be in same repository, but how exactly is that done? I should probably create /backend
folder and server.js
inside it, but where? In the same folder with node_modules
, public
and src
or elsewhere? Also, it would be nice to know more about how information exchange between Node and React works so I can display data fetched from database with React. Thanks in advance.
package.json
ornode_modules
. why not add a script to the currentpackage.json
which runs node?"server": "node server.js"
? – evolutionxbox