In this lab we have the incomplete getJavalinInstance()
method that creates a Javalin object, sets up an endpoint, and returns the Javalin object. Your goal is to finish the method by setting up its remaining endpoints as well as their associated handlers.
An example of an endpoint and a handler are provided in the code.
You will be editing the file Endpoints.java
. It can be found under the src/main/java/com/revature
package.
Review the file's code and code comments. Look for TODO comments: these comments represent the tasks you need to perform to complete the lab. You can find a list of the TODOs in VSCode's Problems pane. To open up the Problems pane, go to View > Problems or use the shortcut "Ctrl + Shift + M" (or "Command + Shift + M" on Mac). We suggest you remove the TODOs as you complete them.
Tasks to Complete:
- Create the POST endpoint to the "/post-request" path and associate it with the handler method you will create named handlePostRequest
- Create the PUT endpoint to the "/put-request" path and associate it with the handler method you will create named handlePutRequest
- Create the DELETE endpoint to the "/delete-request" path and associate it with the handler method you will create named handleDeleteRequest
- Create the PATCH endpoint to the "/patch-request" path and associate it with the handler method you will create named handlePatchRequest
- Create the POST endpoint's related handler based off of its description
- Create the PUT endpoint's related handler based off of its description
- Create the DELETE endpoint's related handler based off of its description
- Create the PATCH endpoint's related handler based off of its description
- To run the tests, click on the
test beaker
icon and run the test cases. Please ensure that you do not already have the program running. - You can optionally run the program for manual testing. Once the program is running, you can create a new terminal and execute the commands mentioned in the
Main.java
file.
You can create a new terminal using the button found in the bottom pane:
Below is an example of manually testing using commands in the terminal:
Note: To see the above image(s), please open this file in Preview mode by using the Ctrl + Shift + V
shortcut (Command + Shift + V
on Mac)