PetStore Application

Introduction

This is a project assignment for middleware SCS3203 module on year 2021 by Harshana Edirisinghe Index No: 18000622 This application was generated by Microprofile.io

This project uses Quarkus, the Supersonic Subatomic Java Framework.

For futher details on quarkus: https://quarkus.io/ .

Packaging and running the application

After navigating into root directory of the project

If you want to build an ??ber-jar, execute the following command:

./gradlew build -Dquarkus.package.type=uber-jar

To run the application:

java -jar build/petstore-runner.jar

The application can be also packaged using simple:

./gradlew build

It produces the quarkus-run.jar file in the build/quarkus-app/ directory. Be aware that it is not an ??ber-jar as the dependencies are copied into the build/quarkus-app/lib/ directory.

To launch , open your browser at the following URL

http://localhost:8080/

Implemented APIs

Get all pets: http://localhost:8080/v1/pets

Add New pet: http://localhost:8080/v1/pets/newPet [need to provide post paramaters in JSON format in the request body]

Update pet: http://localhost:8080/v1/pets/updatePet/{petId}

Delete pet: http://localhost:8080/v1/pets/deletePet/{petId}

Get pet by id: http://localhost:8080/v1/pets/getPet/{petId}

Search pet by name: http://localhost:8080/v1/pets/searchByName/{petName}

Running the application in dev mode

You can run your application in dev mode that enables live loading during development

./gradlew quarkusDev

API documentation

Please refer the following link for API documentation

https://app.swaggerhub.com/apis/husseyhh/harshana-petstore/1.0.0#/

Running test suites

Running cURL test to test the API

Get all pets

curl --location --request GET 'localhost:8080/v1/pets'

Get pet by Id

curl --location --request GET 'localhost:8080/v1/pets/getPet/{id}'

Add pet

curl --location --request DELETE 'localhost:8080/v1/pets//updatePet/1' \
--header 'Content-Type: application/json' \
--data-raw '{
    "petName": "momo",
    "petAge": "5",
    "petType": "kitty"
}'

Delete pet

curl --location --request DELETE 'localhost:8080/v1/pets/deletePet/1' \
--data-raw ''

Update pet

curl --location --request PUT 'localhost:8080/v1/pets/updatePet/2' \
--header 'Content-Type: application/json' \
--data-raw '{
    "petName": "jojo",
    "petAge": "5",
    "petType": "kitty"
}'