A
A
alekseivanov2019-09-19 04:04:19
webstorm
alekseivanov, 2019-09-19 04:04:19

webstorm react. Where is the server part?

I created the project with the create new react app projectt buttons and run it with the npm start command.
When I try to create a mysql connection, I get errors, when I google it, it turns out that this is due to the fact that I add the connection to the "client" javascript, but it should be on the "server".
You can easily understand where the server code is if you create an application in the storm with the new node express project command, there is a path in package.json that leads to the app.js file, there is no such thing in the react project, but there should be something similar. Where can I find the server node javascript?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Andrew, 2019-09-19
@deepblack

there is no such thing in a react project, but there should be something similar. Where can I find the server node javascript?

React - JavaScript library for building user interfaces © reactjs.org What
's with the server side?
If you need something like a fake API during development, please:
https://github.com/typicode/json-server - describe the desired JSON structure and use it.
If you need a full-fledged API, take any backend framework and do it on it.

A
Artem, 2019-09-19
@ulkoart

React has already been written about the essence of the problem - this is not about the server part, to simulate the server part I can advise mockapi , look at next or just create a project with the express server part.

H
hzzzzl, 2019-09-19
@hzzzzl

if you create an application in a storm with the new node express project command, there is a path in package.json that leads to the app.js file

here to make queries to the database, and from here distribute the assembled react-app to the client in the browser,
see for example
https://github.com/Bikranshu/express-react-boilerp...
// Landing page
app.get('*', (req, res) => {
  res.sendFile(path.join(__dirname, '../public/index.html'));
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question