https://github.com/matrizlab/docker-spring-boot
Spring Boot - MongoDB - Basic CRUD
https://github.com/matrizlab/docker-spring-boot
docker docker-image mongodb spring-boot
Last synced: 3 months ago
JSON representation
Spring Boot - MongoDB - Basic CRUD
- Host: GitHub
- URL: https://github.com/matrizlab/docker-spring-boot
- Owner: matrizlab
- Created: 2022-10-30T17:48:04.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-12-06T16:01:01.000Z (over 3 years ago)
- Last Synced: 2025-02-23T08:30:57.241Z (over 1 year ago)
- Topics: docker, docker-image, mongodb, spring-boot
- Language: Java
- Homepage:
- Size: 64.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Spring Boot MongoDB Basic CRUD
### Start
mvn clean install -Dmaven.test.skip
docker-compose build
docker-compose up -d
#### check endpoint
```zsh
curl -v http://localhost:8080/api/welcome
```
### Create
```zsh
curl -X POST localhost:8080/api/categories -H 'Content-type:application/json' -d '{"name": "Category 1"}'
curl -X POST localhost:8080/api/product -H 'Content-type:application/json' -d '{"name": "Product 1", "description": "Desc 1", "price": "123.45", "categoryId": "635f84e60795e14871534960"}'
```
### Read
```zsh
curl -v localhost:8080/api/categories | json_pp
{
"id" : "635f84e60795e14871534960",
"name" : "Category 1"
},
{
"id" : "635f85100795e14871534961",
"name" : "Category 2"
},
{
"id" : "635f85150795e14871534962",
"name" : "Category 3"
}
curl -v localhost:8090/api/products | json_pp
```
### Update
```zsh
curl -X PATCH localhost:8090/api/product/635f871e0795e14871534964 -H 'Content-type:application/json' -d '{"price": "999999.22"}'
```
### Delete
```zsh
curl -X DELETE localhost:8090/api/product/635f888b0795e14871534968
```