Newer
Older
The Project serves the Engine API and handles state management of multiple Engine instances.
This project is based on a swagger-enabled Flask server using an *API First* approach. It also uses the [Connexion](https://github.com/zalando/connexion) library on top of Flask.
```bash
pip3 install -r requirements.txt
# Additional requirements for the chosen database
pip3 install -r contrib/mariadb-requirements.txt
# Create database and user (change password in script)
sudo mysql -u root -p < contrib/mariadb-database.sql
To run the server, please execute the following from the root directory:
./run.sh api
```
To run the API in an local development server execute:
## Running with Docker
To run the server on a Docker container, please execute the following from the root directory:
```bash
# Building the image
./run.sh docker:build
# Push the current image to dockerhub.com
./run.sh docker:push
# Starting up a container
./run.sh docker:api
```
## Using the API
Adding some entry to the playlog:
```bash
curl -d '{ "track_start": "2020-06-27 19:14:00", "track_artist": "Mazzie Star", "track_title": "Fade Into You", "log_source": 1 }' -H "Content-Type: application/json" -X POST http://localhost:8008/api/v1/playlog/store
This newly added entry can be queried using your browser in one of the following ways:
```bash
# Get the latest entry
http://localhost:8008/api/v1/trackservice/current
# Get a set of the most recent entries
http://localhost:8008/api/v1/trackservice/
# Filter some specific page (the three most recent entries)
http://localhost:8008/api/v1/trackservice?page=0&limit=3
```
All other API endpoints are listed in the interactive documentation.