Mock (react) configuration

Mock

Mock can generate random data so that the front-end siege lion can develop independently of the back-end.
First create the react project, and then yarn reject, exposing the webpack configuration.
Insert picture description here
The point is this. Insert picture description here
Insert picture description here
Those who have learned node.js know that this is the secondary routing plus middleware configuration in the express framework, and then modify the directory to path.js under config Insert picture description here
.
Restart the server and try to access
Insert picture description here
the data displayed is our corresponding data.

Add, delete, modify and check based on node

Define an object, which contains various methods,
read operations,
Insert picture description here
write operations,
Insert picture description here
additions, deletions, and modifications.
Insert picture description here
Assuming that the data here is in array JSON format

use

First define a json file, which contains an empty array. Be sure to empty the array, otherwise it will be an object. The object does not have a Push method.
Insert picture description here
Then you can use it directly.
Insert picture description here
Effect

Insert picture description here

Use the plugin BodyParser to get the body

Find the file and import
Insert picture description here
Insert picture description here
it so it can be used.

Guess you like

Origin blog.csdn.net/lin_fightin/article/details/113555219