Answer the question
In order to leave comments, you need to log in
How to write Server Code in React App?
(Possibly a very dumb question, but still)
I want to write sending data to the database and the question is, if the React application runs its own local server, then how can I write my own? Like, I usually start my server in Express and I’m already working with it, but what’s the matter, I didn’t find the server script in the React application files.
And please advise which database to use with Express, MongoDB?
Answer the question
In order to leave comments, you need to log in
1) Write your server in Express, and with React send a POST request to the server via fetch or xhr. But make the server on a different port (for example, React on 5000, and Express on 8080) and configure the proxy. The main thing is to start the server and the application at the same time. Here concurrently is great if you do it via npm.
2) You can use any, even though MariaDB, but MongoDB is also great.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question