I have developed this REST API in 2019 as a part of coding assignment for one of the Fintech firm in Singapore.
I have decided to opensource it now.
The ask was:
- To build a simple REST API which should support CRUD operations like GET, POST, PUT, PATCH and DELETE on a student database.
- MySQL DB should be used to store the student details.
- It should also support H2 in-memory DB for unit testing.
- The solution should use Spring JPA (Java Persistence API) and Hibernate to abstract the database related operations.
- To have some basic unit tests using Mockito
- Integration tests against the H2 database
- Write some Cucumber E2E tests to verify the CRUD operations are working fine.
- The whole solution should be Containerized and can be started using docker.
- CI/CD Pipeline using Jenkins (now changed to Github Actions) where all the unit, integration and cucumber acceptance tests should be executed, before deploying the docker image to Docker hub.
- The API documentation should be accessible using Swagger URL.
docker run sahajamit/student-enrollment-api
mvn spring-boot:run
The application will run on the port 8081 by default.
To explore the API, the swagger documentation for this api can be seen using this url
http://localhost:8081/swagger-ui.html
mvn -q test -Dtest=StudentApiUnitTests
mvn -q test -Dtest=StudentApiIntegrationTests
mvn -q test -Dtest=RunCucumberTest
/target/html-reports/cucumber-html-reports/overview-features.html
/target/surefire-reports