Welcome to the second post in this series of backend challenges.
In the first challenge we face creating an API without a database connection. This time we will increase the difficulty a little.
We need to keep track of the weight of a client named Ramon, so for that we need to create a system with the following.
{ "weight": 125.5, "date": "2024-02-12" }
The routes should be like the following
GET localhost/api/weights POST localhost/api/weights PUT localhost/api/weights DELETE localhost/api/weights
In the delete and put method you need to pass an id inside the body of the json to delete or update.
Weight table
CREATE TABLE weights ( id INTEGER PRIMARY KEY AUTOINCREMENT, weight DOUBLE, weight_date DATE );
The above is the detailed content of Backend Straight #2. For more information, please follow other related articles on the PHP Chinese website!