The idea of this project is to show how Starlette, Marshmallow, and SQLAlchemy can be combined to create a RESTful HTTP API application that is modular, lightweight, and capable of dealing with many simultaneous requests.
Requires Python 3.9+, git, and poetry.
$ git clone https://github.com/rbw/records.git
$ cd records
$ poetry update
The application requires an SQLAlchemy-supported relational database. This example uses pg.ARRAY in AlbumModel, making it compatible with Postgres only.
A docker-compose file for running a Postgres server is available in the project root.
$ docker-compose up
$ poetry shell
$ python -m records
$ curl http://localhost:5000/albums
$ curl -X POST --data '{"title": "test", "release_date": "2035-01-20", "stores": ["APPLE", "YOUTUBE"], "tracks": ["TEST000000001", "TEST000000002"], "upc": "00000000000005"}' http://localhost:5000/albums
$ curl http://localhost:5000/albums/00000000000005
Add Tracks API[GET/POST/DELETE => /tracks,/tracks:trackid:]
Implement add-tracks-to-album[POST => /albums/:albumid:/tracks]
Implement del-track-from-album[DELETE => /albums/:albumid:/tracks/:trackid:]
- Implement query filtering
- Add CLI
- Project docs
- Code docs
- Automated tests
Consider leaving a donation if you like this software.
Robert Wikman <rbw@vault13.org>