Backend server for quiz contest.
- go 1.15
- docker 19.03.12
- docker-compose 1.26.2
Remember to run a postgreSQL databse on localhost.
go run cmd/main.goReset all records in the current database.
go run cmd/main.go -resetLoad dev data from external static file within directory example_data/.
go run cmd/main.go -loaddevLoad prod data from external static file within directory data/.
go run cmd/main.go -loadRemember to run the service before execute fvt.
go run cmd/main.go -fvtdocker build -t rainrainwu/quiz-server:latest .Server will listen on the port 8080, so make sure it was available.
docker-compose updocker-compose downThe service provides an interacting interface via RESTful API, below is the list of all endpoints:
GET /v1/players
POST /v1/players
DELETE /v1/players/:player_name
GET /v1/players/:player_name/feed
GET /v1/quizzes?tag=<tag_name>
POST /v1/quizzes
GET /v1/quizzes/:quiz_number
DELETE /v1/quizzes/:quiz_number
GET /v1/quizzes/:quiz_number/tags
POST /v1/quizzes/:quiz_number/tags
DELETE /v1/quizzes/:quiz_number/tags/:tag_name
GET /v1/tags
POST /v1/tags
GET /v1/answers?player=<player_name>&quiz=<quiz_number>
POST /v1/answers
GET /v1/provokes?correct=<correctness>
POST /v1/provokes
You can create new players, list all players by score, and feed a quiz for a user through these api endpoints.
You can create new quizzes, access current quizzes, and update tags of a quiz through these api endpoints.
You can create or delete tags through these api endpoints.
You can upload or query answers from players to quizzes through these api endpoints.
You can uplaod new provoke messages or query messages by correctness through these api endpoints.
Please refer to out.md for more details of requests and responses.