Please review the following resources before lecture:
[1 Min Java Quick Tip | Using the Builder Pattern (Video)](https://www.youtube.com/watch?v=BDYSveH9Q14) |
We are continuing to build atop the foundation of our library app. For this assignment, you will help implement the API that will be used by a yet-to-come front-end app.
GET /items
- Retrieves a list of media itemsPOST /items
- Creates a new media itemGET /items/:id
- Retrieves a single media item with the given ID.DELETE /items/:id
- Deletes a single media item with the given ID.com.codedifferently.lesson26.web
package.You can run the server using the usual ./gradlew run
command from the api/java
directory. If you want to test that the server is running correctly, you can use curl
like so:
curl http://localhost:3001/items | json_pp
The project also includes an OpenAPI user interface (Swagger) for navigating the API. Just visit http://localhost:3001/swagger-ui.html to access it.
Alternatively, you can also test the API using the tool Postman. I recommend installing this tool to make it easier to test things.
Remember that you can debug the API by visiting the main function in Lesson26.java and clicking Debug main
. You’ll be able to set breakpoints in your code to see what’s happening and fix issues.
This project also includes a fully functioning TypeScript version of the Java project. You can visit api/javascript/api_app
to execute it using npm start
and view the OpenAPI documentation at http://localhost:3000/api (note that it runs on port 3000).