Libman is a basic REST API built using Spring Web, Spring Data Java Persistence API (JPA), and H2 Database
- Spring Data JPA: provides a standardized way to manage relational data in Java applications
- Spring Web: creates document-driven web services and facilitates contract-first Simple Object Access Protocol (SOAP) service development
- H2 Database: supports CRUD operations with data stored in an embedded, open-source, in-memory database
GET
- Book
- by ID
POST
- Book
- with title and author
PUT
- Book
- by ID
DELETE
- Book
- by ID
Warning
This version of the API (0.0.1-SNAPSHOT) is not considered to be a RESTful service yet.
- Add a new field(s) to the
Book
entity, such as pages, date published, volume, and edition - Update POST methods to return a proper response
- Update PUT methods to return a proper response
- Update DELETE methods to return a proper response
- Incorporate Lombok to reduce boilerplate on entities
-
Update theBook
entity to handle different states, such as available, on hold, and unavailable - Change the
Book
entityBookStatus
field to a numerical field with available copies - Change
BookController
structure to handle links with different states - Build new controllers implementing Hypermedia as the Engine of Application State (HATEOAS)
- Add support for new entities such as
User
and/orLibrarian
- Add JWT-based authentication in-memory
- Implement Spring Security to handle requests from different roles, such as:
- ADMIN: manages users (CRUD operations)
- LIBRARIAN: manages books (CRUD operations), mark books as returned, update holds, flag users
- USER: borrow, hold, renew books
Caution
The User
entity uses annotations from both @Entity (jakarta.persistence.Entity) and @Data (lombok.Data).
This may result in conflicts between Lombok's creation of getters and setters along with Hibernate's @UpdateTimestamp
.
Check this StackOverflow post again in case a breaking change occurs.
- Uniform interface
- Client-server
- Stateless
- Cacheable
- Layered system
- Code on demand
- Register a user:
curl -H "Content-Type: application/json" -d '{"email": "[email protected]", "password": "ILoveKokomi", "username": "Koi Fish"}' localhost:8080/api/v1/signup
- Login using an existing user's account information:
curl -H "Content-Type: application/json" -d '{"email": "[email protected]", "password": "ILoveKokomi"}' localhost:8080/api/v1/login