06 Rest & Test
- Reviewing portfolio projects. Today we would like to see your documentation of your API endpoints and far you have come with your implementation.
- Rest-assured.io (5 min)
- Short Rest Assured Tutorial, read 1-7 (5 min)
- Hamcrest guide (skim and use for reference 10 min)
Watch these videos to get an introduction to Websockets and Webhooks:
- Websockets explained (7:14)
- Webhooks for beginners (7:32)
- Top 3 things you should know about Webhooks (3:54)
Skim through the following documentation to get an overview of how to implement Websockets in Javalin:
- Have a look at these wonderful protocols
- Dice Websocket demo
- Clone the repo and run the Websocket server in IntelliJ.
- Connect two browser windows to
http://localhost:7070and test the dice game by clicking the “Roll Dice” button. You should see the dice rolls in both windows. - Choose one server machine in the class rooom and let the rest of the class connect to that machine’s IP address and port.
- Figure out why it works ;-)
- Refactor the code to have a better separation of concerns. For example, you could create a separate class for handling the game logic and another class for handling the Websocket communication etc, separate the css to a separate file etc.
- Begin adding functionality. Like who rolled the dice. Saving the game history to a database, adding a chat functionality etc.
- This one is for you to work on your portfolio project. Begin by writing tests for your API endpoints and then implement the endpoints if you haven’t already.