DEV Community

Carlos Estrada
Carlos Estrada

Posted on

Backend challenge #2

Welcome back to the second post of this series to practice and learn more about backend development.

In the first post we look at how to the first challenge that was a basic api with no connection to a db. This time we will improve and increase the difficulty of the challenge.

If you miss the first part you can check out here

1 Endpoint api with connection to a sql database

Project description

We need to record the weight progression of a client called Ramon, so for that we need to create a system with the next requirements.

Requirements

  • Save the next format for the weight measure
{
  "weight": 125.5,
  "date": "2024-02-12"
}
Enter fullscreen mode Exit fullscreen mode
  • The data should be store in a sqlite database (You will recieve the sql syntax for creating the table of weights at the end of this section)
  • The api that we will use ramon should have just 1 endpoint with the name: weights
  • Ramon can update, delete, create and read the data of the weights
  • Pass an id in a json body when delete or update the resource ### Starting kit

The routes should be like the next one:

GET localhost/api/weights

POST localhost/api/weights

PUT localhost/api/weights

DELETE localhost/api/weights
Enter fullscreen mode Exit fullscreen mode

In the delete and put method You need to pass an id field for identify what resource should be update or delete

SQL For the project

Table weights

CREATE TABLE weights (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  weight DOUBLE,
  weight_date DATE
);
Enter fullscreen mode Exit fullscreen mode

Top comments (0)