Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jusqua/spring-api-exemple
Spring Boot RestAPI exemple
https://github.com/jusqua/spring-api-exemple
database java-21 maven postgresql rest-api spring-boot sql
Last synced: 1 day ago
JSON representation
Spring Boot RestAPI exemple
- Host: GitHub
- URL: https://github.com/jusqua/spring-api-exemple
- Owner: jusqua
- Created: 2024-07-24T18:39:00.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-09-06T16:45:23.000Z (2 months ago)
- Last Synced: 2024-09-07T16:59:23.388Z (2 months ago)
- Topics: database, java-21, maven, postgresql, rest-api, spring-boot, sql
- Language: Dockerfile
- Homepage:
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Spring API Example
## Getting Started
### Dependencies
- Java 21
- Docker Compose### Running
```shell
docker compose up # up postgres database
./mvnw spring-boot:run # run spring server
```## Routes
### Users
- GET `/users`: return all users
```json
[
{
"id": integer,
"name": string,
"email": string
}, ...
]
```
- GET `/users/{id}`: return user from given id
#### Return
```json
{
"id": integer,
"name": string,
"email": string
}
```
- DELETE `/users/{id}`: delete user from given id
- PUT `/users/{id}`: update user from given id and given body structure, and return the updated structure
#### Request Body
```json
{
"name": string,
"email": string
}
```
#### Return
```json
{
"id": integer,
"name": string,
"email": string
}
```
- POST `/users`: create user from given body structure and return the created structure
#### Request Body
```json
{
"name": string,
"email": string
}
```
#### Return
```json
{
"id": integer,
"name": string,
"email": string
}
```