Skip to content

API: overview ​

The API is the keeper of the data: it stores the products in PostgreSQL and exposes them as JSON to the web front end.

At a glance ​

TopicDetail
Folderapi/
LanguagePython 3.11
Framework 4.2 +
Prod server, 3 workers
Database 17 (dev and prod), for tests and locally
Live addresshttps://api.trinity.jostud.com (prod), https://api.dev.trinity.jostud.com (dev)
Clientsthe web front end
Tests7 tests (pytest-django)
OwnerPatrice

What the part does ​

Its architecture ​

  • urls.py maps each address to a view.
  • ProductViewSet provides the five operations without writing them one by one.
  • ProductSerializer turns a product into JSON, and checks the JSON received.
  • Product describes the table; Django's writes the SQL.

Before you start

If Django, a serializer or a migration mean nothing to you, read The basics first.

Going further ​

You want to…Read
run the API on your machineRun the project
know the product tableDatabase
know what the API accepts and refusesProducts
read the real code explainedIn depth
the list of endpointsReference
add a routeAdd a route