Skip to content

alan-turing-institute/clioguesser_backend

Repository files navigation

clioguesser_backend

Back end repo for the Clioguesser historical geography game

Installation

  1. Clone the repository:
    git clone --recurse-submodules <repository-url>
    cd clioguesser_backend
    

Docker

You can run the docker container containing the backend by running:

   docker compose up -d

API calls

Get the polity data for a given year:

GET /api/polities/?year=2000

Test with curl:

curl -X GET "http://localhost:8000/api/polities/?year=2000"

Get the current leaderboard:

GET /api/leaderboard/

Test with curl:

curl -X GET "http://localhost:8000/api/leaderboard/"

Update the 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

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"

Django notes

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

About

Back end repo for the Clioguesser historical geography game

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •