Refactoring_Restful API URI
β Mid Feedback
In order for the API to be Representational of the State, it should follow some conditions.
It should have a uniform interface.
Thus, the URIs have to explain the resource.
ππ» Before to ππ» After
βοΈ Auth
| ππ» URI Before | Method | ππ» URI After |
|---|---|---|
| auth/sign-up | POST | /auth/sign-up |
| auth/login | POST | /auth/login |
| auth/nickname-check | GET | /auth/nickname |
| auth/email-check | GET | /auth/email |
| auth/findEmail | GET | /auth/find-email |
| auth/change-password | PUT | /auth/password |
| email/send | GET | /email/send |
| email/auth-num-check | GET | /email/auth-num |
βοΈ Cart
| ππ» URI Before | Method | ππ» URI After |
|---|---|---|
| cart/myCart | GET | /cart |
| cart/add | POST | /cart |
| cart/update | PUT | /cart |
| cart/delete | DELETE | /cart |
| cart/empty | DELETE | /cart/empty |
βοΈ Likes
| ππ» URI Before | Method | ππ» URI After |
|---|---|---|
| likes | POST | /likes |
| likes/deelte | DELETE | /likes |
| likes/mylikes | GET | /likes |
βοΈ Main Page
| ππ» URI Before | Method | ππ» URI After |
|---|---|---|
| /main | GET | /main |
| main/category | GET | /main/category |
| main/find | GET | /main/find |
βοΈ Detail
| ππ» URI Before | Method | ππ» URI After |
|---|---|---|
| product/detail | GET | /product |
| product/review/{productId} | POST | /product/review/{productId} |
| product/question/list | GET | /product/question |
| product/question | POST | /product/question |
| product/answer | POST | product/answer |
| product/question/del | DELETE | /product/question |
| product/question/update | PUT | /product/question |
βοΈ MyPage
| ππ» URI Before | Method | ππ» URI After |
|---|---|---|
| mypage/review/add | POST | /mypage/review/{ordersId} |
| mypage/review/update | PUT | /mypage/review/{ordersId} |
| mypage/review/delete | DELETE | /mypage/review/{ordersId} |
| mypage/product | GET | /mypage/order |
| mypage/userInfo | GET | /mypage/userInfo |
| mypage/question/get | GET | /mypage/question |
| mypage/reviews | GET | /mypage/reviews |
| mypage/coupon/get | GET | /mypage/coupon |
βοΈ Order
| ππ» URI Before | Method | ππ» URI After |
|---|---|---|
| order/cartToOrder | GET | /order/cart-to-order |
| order/pay | PUT | /order/order-to-pay |
| admin/addProduct | POST | /admin/product |
This post is licensed under CC BY 4.0 by the author.