Skip to content

Demo Spring Boot application using Spring Boot v2.5.9

Notifications You must be signed in to change notification settings

zorawars/demo-ehi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Demo Patient Application

Spring Boot application that allows API access to Patient information using REST over HTTP.

Building the project

Run the below maven command to run all tests, generate the OpenAPI YAML file using Springdoc, code coverage using Jacoco, and build the application jar file.

$ ./mvnw clean verify

Code Coverage

The project uses Jacoco for code coverage. After running the maven verify command the Jacoco report will be available under target/code-coverage. View the report target/code-coverage/index.html in a browser.

Running the application locally

Use the maven spring-boot-plugin to run the application locally.

$ ./mvnw spring-boot:run

Once the application comes up it is available at http://localhost:8080/ehi.

REST Endpoints to access Patient information

OpenAPI 3.0 Documentation

The OpenAPI YAML file documenting the REST API is generated and available under the project root at springdoc-ehi-patient.yaml. This can be imported into Postman.

Curl commands

  • Get all patients, by default 50 at a time.
$ curl -X 'GET' 'http://localhost:8080/ehi/patients'
  • Get all patients whose first name contains Ste.
$ curl -X 'GET' 'http://localhost:8080/ehi/patients?first_name=Ste'
  • Get first 5 patients.
$ curl -X 'GET' 'http://localhost:8080/ehi/patients?size=5'
$ curl -X 'GET' 'http://localhost:8080/ehi/patients?page=0&size=5'
  • Get patient with ID=6.
$ curl -X 'GET' 'http://localhost:8080/ehi/patients/6'
  • Add new patient.
$ curl -X 'POST' 'http://localhost:8080/ehi/patients' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "firstName": "John",
  "lastName": "Doe",
  "dateOfBirth": "1986-01-01"
}'

About

Demo Spring Boot application using Spring Boot v2.5.9

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages