Table of Contents
This is a template for a REST API using Spring Boot. It was created to be used as a base for future projects.
- REST API
- Domain-Driven Design
- Tests with JUnit Jupiter, MockMvc and Mockito
- Databases with H2 embedded database
- Custom Exception Handling
- Swagger UI API
-
. Clone the repo
Fork or clone the repo: https://github.com/farvic/cinema-room-spring.git
-
Run using Maven or your IDE
mvn spring-boot:run
-
In order to run the tests
mvn test
-
Some relevant lines from the application.properties
# localhost:8080/ port=8080 # localhost:8080/swagger-ui/index.html springdoc.swagger-ui.path=/swagger-ui.html springdoc.api-docs.path=/v3/api-docs sprindoc.swagger-ui.config-url=/v3/api-docs/swagger-config springdoc.swagger-ui.url=/v3/api-docs # H2 Database name - in memory database spring.datasource.url=jdbc:h2:mem:testdb spring.h2.console.enabled=true # localhost:8080/h2-console spring.h2.console.path=/h2-console spring.datasource.driverClassName=org.h2.Driver # authentication to access the database console spring.datasource.username=sa spring.datasource.password=
-
An API documentation can be accessed through localhost:8080/swagger-ui/index.html once the program is running
- Create a basic REST API
- Add a database support
- Add a Swagger UI API documentation
- Add tests for the controllers, services and repositories
- Add a security layer
- Add remote database support
- Add a Dockerfile for the application
- And more...?
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
If you want to talk about the project, feel free to contact me through one of my socials.
Victor Fonseca - @Linkedin
Project Link: https://github.com/farvic/cinema-room-spring