Skip to content

seosh817/SpringBoot-eStore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

2) API method

- Create/Add(POST): create new product

request: http://localhost: 9090/api/v1/products POST image

response:

image

image

- Get full list of products:

request: http://localhost:9090/api/v1/products GET

response : image

[
    {
        "id": 1,
        "name": "TV",
        "category": "electronics",
        "price": 3000,
        "manufacturer": "Samsung",
        "unitInStock": 200,
        "description": "Good Quality TV"
    },
    {
        "id": 2,
        "name": "Desktop",
        "category": "electronics",
        "price": 2500,
        "manufacturer": "Samsung",
        "unitInStock": 100,
        "description": "Gaming DeskTop"
    },
    {
        "id": 3,
        "name": "NoteBook",
        "category": "electronics",
        "price": 2000,
        "manufacturer": "Apple",
        "unitInStock": 100,
        "description": "MacBook Pro"
    },
    {
        "id": 4,
        "name": "NoteBook",
        "category": "electronics",
        "price": 2000,
        "manufacturer": "Apple",
        "unitInStock": 100,
        "description": "MacBook Air"
    },
    {
        "id": 5,
        "name": "Shoes",
        "category": "clothes",
        "price": 300,
        "manufacturer": "Adidas",
        "unitInStock": 10,
        "description": "Adidas YeezyBoost"
    },
    {
        "id": 6,
        "name": "Pants",
        "category": "clothes",
        "price": 50,
        "manufacturer": "Nike",
        "unitInStock": 2000,
        "description": "Nike Training Pants"
    },
    {
        "id": 7,
        "name": "Hat",
        "category": "clothes",
        "price": 30,
        "manufacturer": "Adidas",
        "unitInStock": 3000,
        "description": "Adidas Cap"
    },
    {
        "id": 8,
        "name": "Mouse",
        "category": "electronics",
        "price": 30,
        "manufacturer": "Logitech",
        "unitInStock": 4000,
        "description": "Logitech G102"
    },
    {
        "id": 9,
        "name": "Bag",
        "category": "clothes",
        "price": 40,
        "manufacturer": "Eight Seconds",
        "unitInStock": 5000,
        "description": "EightSeconds BackPack"
    },
    {
        "id": 10,
        "name": "Phone",
        "category": "electronics",
        "price": 200,
        "manufacturer": "Samsung",
        "unitInStock": 20,
        "description": "Galaxy S8+"
    },
    {
        "id": 11,
        "name": "DeskTop",
        "category": "electronics",
        "price": 2000,
        "manufacturer": "LG",
        "unitInStock": 10,
        "description": "LG DeskTop"
    }
]

- Get details of products with id=N

request : http://localhost:9090/api/v1/products/2 GET

response : image

- fetch all products of a category

request : http://localhost:9090/api/v1/products/category/clothes GET

response : image

[
    {
        "id": 5,
        "name": "Shoes",
        "category": "clothes",
        "price": 300,
        "manufacturer": "Adidas",
        "unitInStock": 10,
        "description": "Adidas YeezyBoost"
    },
    {
        "id": 6,
        "name": "Pants",
        "category": "clothes",
        "price": 50,
        "manufacturer": "Nike",
        "unitInStock": 2000,
        "description": "Nike Training Pants"
    },
    {
        "id": 7,
        "name": "Hat",
        "category": "clothes",
        "price": 30,
        "manufacturer": "Adidas",
        "unitInStock": 3000,
        "description": "Adidas Cap"
    },
    {
        "id": 9,
        "name": "Bag",
        "category": "clothes",
        "price": 40,
        "manufacturer": "Eight Seconds",
        "unitInStock": 5000,
        "description": "EightSeconds BackPack"
    }
]

- Update (PUT): modify values of product with id=N

request : http://localhost:9090/api/v1/products/2 PUT

image

response :

image image

- Delete (DELETE): delete product with id=N

request : http://localhost:9090/api/v1/products/2 DELETE

response : image

3) Spring Boot의 actuator를 활용하여 Products REST API에 대한 URL Mapping 정보를 캡쳐

image image image image image image image

About

SpringBoot + Spring Data JPA

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published