If you are not familiar with how elections work in the UK, please see this short BBC video https://www.youtube.com/watch?v=cRxUhGetEPQ
The results API presents a simple elections result service.
The domain for the election represents some key concepts:
- constituencyId a unique integer id to identify a location. E.g "Brent Central" is 90
- party is a short 3, or 4, letter code for a party for instance LAB = Labour, CON = Conservative etc.
- votes the number of votes gained by a party in a constituency
- share the % share of the total votes the party received
The API has 3 endpoints:
- GET
/result/{id}
to get an elections result for a given id. - POST
/result
to add a new result - GET
/scoreboard
to get the running totals. This is unimplemented.
During your assessment we will ask you to work though the task in tasks.md
with a pair. Please do not work on or complete these prior to the assessment.
Warning: If you make any changes to the code, please ensure you return it to its initial (HEAD) state before your assessment.
- Java 11
- Scala
- sbt
sbt compile
sbt run
You may get a port error when you try to run this. If so, run the following command:
export PLAY_HTTP_PORT=9001
sbt test