- Java 21
- Maven 3.9.*
- PostgreSQL 15+
- Run the command
mvn clean install
to compile and generate jar file.
- Set environment variables
key | value |
---|---|
db_url | jdbc:postgresql://{ADDRESS}:{PORT}/{DATABASE_NAME} |
db_user | DATABASE_USERNAME |
db_pass | DATABASE_PASSWORD |
- Meet all the requirements
- Run the command
mvn clean install
to compile and generate jar file. - Run in the root folder
docker compose up -d
Base url http://localhost:8090/api/v1/library
GET [BASE_URL]/books/all
Code: 200
Body:
[
{
"id": 1,
"title": "5 AM Club",
"author": "Robert Sharma",
"isbn": "123-456-789",
"available": false
}
]
POST [BASE_URL]/books/register
Body
{
"title": "5 AM Club",
"author": "Robert Sharma",
"isbn": "123-456-789"
}
Code: 201
Body:
{
"id": 1,
"title": "5 AM Club",
"author": "Robert Sharma",
"isbn": "123-456-789",
"available": true
}
POST [BASE_URL]/borrower/register
Body:
{
"name": "Ahmad",
"email":"test@test.com"
}
Code: 200
Body:
{
"id": 1,
"name": "Ahmad",
"email": "test@test.com"
}
POST [BASE_URL]/return/books/{bookId}/borrowers/{borrowerId}
Variable | value |
---|---|
bookId | 1 |
borrowerId | 1 |
{
"message": "Book is successfully returned"
}
POST [BASE_URL]/borrow/books/{bookId}/borrowers/{borrowerId}
Variable | value |
---|---|
bookId | 1 |
borrowerId | 1 |
{
"message": "Successfully borrowed a book"
}
Note Insomina file can be imported into Insomia client for the testing of API.