Tutorial on how to build a REST api with Spray and Akka
Article: How to build a REST api with Spray and Akka
Clone the repository:
> git clone https://github.com/DanielaSfregola/quiz-management-service.git
Get to the spray-akka
folder:
> cd spray-akka
Run the service:
> sbt run
The service runs on port 5000 by default.
Quiz entity:
case class Quiz(id: String, question: String, correctAnswer: String)
Question entity:
case class Question(id: String, question: String)
Answer entity:
case class Answer(answer: String)
curl -v -H "Content-Type: application/json" \
-X POST http://localhost:5000/quizzes \
-d '{"id": "test", "question": "is scala cool?", "correctAnswer": "YES!"}'
curl -v -X DELETE http://localhost:5000/quizzes/test
curl -v http://localhost:5000/questions
curl -v http://localhost:5000/questions/test
curl -v -H "Content-Type: application/json" \
-X PUT http://localhost:5000/questions/test \
-d '{ "answer": "YES!" }'