![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Python implementation of Node JSON Server (Flask as backend).
Make a full REST API without coding!
pyjserver is a python implementation of Node JSON Sever,
which creates a full REST api (with GET, POST, PUT and DELETE methods) based on json file.
Python JSON Server library is on PyPi repository, so it can be installed with pip
.
>>> pip install pyjserver
After install pyjserver, create db.json
file with the endpoints and data.
{
"python-libs": [
{
"id": 1,
"name": "pyjserver",
"version": "1.0.0"
},
{
"id": 2,
"name": "flask",
"version": "1.1.0"
},
{
"id": 3,
"name": "flask-restful",
"version": "0.3.8"
}
]
}
Run the pyjserver cli command.
>>> python -m pyjserver my-server ./db.json
OR
>>> python3 -m pyjserver my-server ./db.json
And the follow output will be displayed:
* Serving Flask app "my-server" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
* Running on http://localhost:5000/ (Press CTRL+C to quit)
Now to test the API, if you go to http://localhost:5000/python-libs you will get the same json in db.json.
[{"id":1,"name":"pyjserver","version":"1.0.0"},{"id":2,"name":"flask","version":"1.1.0"},{"id":3,"name":"flask-restful","version":"0.3.8"}]
With the same URL, you can send POST requests to add, PUT requests to edit and DELETE requests to remove from json file.
TIP
for each json key, it will be created an endpoint with GET, POST, PUT and DELETE HTTP methods.
You can also see all available endpoints in root url (http://localhost:5000/).
{
"endpoints" : [
{
"name" : "python-libs",
"route" : "/python-libs"
}
],
"methods" : [
"GET",
"POST",
"PUT",
"DELETE"
]
}
Format: JSON object with a list of JSON objects.
Main JSON key: name of the endpoint
JSON list value: list with all records for the endpoint. To start with no data, just place an empty list []
JSONs inside the list: each record for the endpoint. DO NOT FORGET TO ADD SEQUENTIAL ID
KEY FOR EACH RECORD
{
"endpoint-1": [
{
"id": 1,
"name": "data 01"
},
{
"id": 2,
"name": "data 02"
}
],
"endpoint-2": [
{
"id": 1,
"name": "another data 01"
}
],
"endpoint-3": []
}
So the JSON above will create 3 endpoints /endpoint-1
(with 2 record data), endpoint-2
(with 1 record data) and endpoint-3
(with no record data).
The home page for this json file will display:
{
"endpoints" : [
{
"name" : "endpoint-1",
"route" : "/endpoint-1"
},
{
"name" : "endpoint-2",
"route" : "/endpoint-2"
},
{
"name" : "endpoint-3",
"route" : "/endpoint-3"
}
],
"methods" : [
"GET",
"POST",
"PUT",
"DELETE"
]
}
For each endpoint created, is allowed GET
, POST
, PUT
and DELETE
HTTP method.
>>> curl http://localhost:5000/endpoint-1/
[{"id":1,"name":"data 01"},{"id":2,"name":"data 02"}]
>>> curl -d '{"name": "data 03"}' -H 'Content-type: application/json' -X POST http://localhost:5000/endpoint-1/
{"id":3,"name":"data 03"}
>>> curl http://localhost:5000/endpoint-1/
[{"id":1,"name":"data 01"},{"id":2,"name":"data 02"},{"id":3,"name":"data 03"}]
>>> curl -d '{"name": "data 02 edited"}' -H 'Content-type: application/json' -X PUT http://localhost:5000/endpoint-1/2
{"id":2,"name":"data 02 edited"}
>>> curl http://localhost:5000/endpoint-1/
[{"id":1,"name":"data 01"},{"id":2,"name":"data 02 edited"},{"id":3,"name":"data 03"}]
>>> curl -X DELETE http://localhost:5000/endpoint-1/2
{}
>>> curl http://localhost:5000/endpoint-1/
[{"id":1,"name":"data 01"},{"id":3,"name":"data 03"}]
REMEMBER: all the data is inside the db.json
file, so any change with the HTTP method it will also change the file.
Consequently, if change the file, it will change the API.
NOTE: if you edit the json file and add an endpoint with pyjserver running, it will be necessary to restat the application to it load the new endpoint. But it is not necessary if you edit the file and add new records.
MIT
FAQs
Python implementation of Node JSON Server (Flask as backend)
We found that pyjserver demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.