Back end repo for the Clioguesser historical geography game
- Clone the repository:
git clone --recurse-submodules <repository-url> cd clioguesser_backend
You can run the docker container containing the backend by running:
docker compose up -d
GET /api/polities/?year=2000
Test with curl:
curl -X GET "http://localhost:8000/api/polities/?year=2000"
GET /api/leaderboard/
Test with curl:
curl -X GET "http://localhost:8000/api/leaderboard/"
Update the leaderboard with a new score:
POST /api/leaderboard/update/
Content-Type: application/x-www-form-urlencoded
initials=ABC&score=1234
Test with curl:
curl -X POST -d "initials=ABC&score=123" http://localhost:8000/api/leaderboard/update/
Calculate a score based on year range, true year, and guess:
GET /api/score/?min_year=1000&max_year=2000&true_year=1500&guess_year=1400&multiplier=365
Test with curl:
curl -X GET "http://localhost:8000/api/score/?min_year=1000&max_year=2000&true_year=1500&guess_year=1400&multiplier=365"
If you add a new model, you need to create a migration file:
cd clioguesser_backend
python manage.py makemigrations
Then apply the migration:
python manage.py migrate