https://github.com/kmanadkat/udnd-java-rest-simple
Java Springboot - Build A Simple REST API
https://github.com/kmanadkat/udnd-java-rest-simple
Last synced: 6 months ago
JSON representation
Java Springboot - Build A Simple REST API
- Host: GitHub
- URL: https://github.com/kmanadkat/udnd-java-rest-simple
- Owner: kmanadkat
- License: mit
- Created: 2024-02-20T15:06:23.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-08T14:28:03.000Z (over 1 year ago)
- Last Synced: 2025-02-01T04:43:20.003Z (8 months ago)
- Language: Java
- Homepage:
- Size: 76.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
### Java Springboot - Build A Simple REST API
API that returns a list of dogs from an embedded H2 in memory database. It uses [Spring Initializer](https://start.spring.io/) to bootstrap the project with following dependencies:
1. `spring-boot-starter-web` - This starter pack is used for web application development and automatically adds libraries like Spring MVC, REST, Tomcat, and Jackson.
2. `com.h2database` - This starter pack is used for the H2 in-memory database.
3. `spring-boot-starter-data-jpa` - This starter pack includes JDBC, Hibernate, Transactions API, JPA, and Aspects.### Database Entity
```mermaid
classDiagram
class Dog
Dog: Long id
Dog: String name
Dog: String breed
Dog: String origin
```### Execution Flow
```mermaid
sequenceDiagram
participant Client
participant Controller
participant Service
participant Repository
participant DatabaseClient->>Controller: GET Request
Controller->>Service: Forward Request
Service->>Repository: Execute Business Logic
Repository->>Database: Query DataRepository-->>Service: Parse Data
Service-->>Controller: Form Response
Controller-->>Client: Response
```### API Endpoints
The following table lists the available API routes for the Dog REST API project:| Route | Method | Description |
|---------------|--------|---------------------|
| `/dogs` | GET | Get all dogs |
| `/dogs/breed` | GET | Get all dogs breed |
| `/{id}/breed` | GET | Get breed by dog id |
| `/dogs/name` | GET | Get all dogs name |### Swagger UI Docs
http://localhost:8080/swagger-ui/index.html