MERN 풀스택을 공부하고 나서 어떻게 코드를 짜야할 지 틀을 잡을 수 있었다.
공부한 내용으로 프로젝트 설계를 처음부터 다시 진행하기로 했다.
1. Database
- User
- name, email, password, address, phone_number: String
- admin: Boolean
- cart, purchase_history: [ Product_id 연결 ]
- Product
- name, description, image, category: String
- price, stock: Number
- Review
- content: String
- star: Number
- user: User_id 연결
- product: Product_id 연결
2. Frontend
- 사용자
Route | Content | Is login |
/ | Home (List of All products) | O / X |
/login | Login form | X |
/signup | Signup form | X |
/category/:cid | List of products in a category | O / X |
/product/:pid | Information of a product | O / X |
/user/:uid | Information of a user(My page) | O |
/cart/:uid | List of products in cart | O |
/edit/:uid | Edit user information form | O |
/history/:uid | Show purchase history | O |
/review/:uid | Show reviews of specific user | O |
- 관리자
Route | Content |
/product/new | Create new product form |
/product/edit/:pid | Edit product form |
3. Backend
- /api/users
Method | Route | Content |
GET | /:uid | Get a user's information |
POST | /signup | Create new user + Login |
POST | /login | Login |
POST | /:uid | Pay for products |
PATCH | /:uid | Edit user information |
- /api/products
Method | Route | Content |
GET | / | Get all products |
GET | /:pid | Get a specific product |
GET | /category/:cid | Get products in category |
POST | / | Create a new product |
PATCH | /:pid | Edit a product |
DELETE | /:pid | Delete a product |
- /api/reviews
Method | Route | Content |
GET | /product/:pid | Get reviews of a product |
GET | /user/:uid | Get reviews of a user |
POST | / | Create a review |
DELETE | /:rid | Delete a review |
- /api/carts
Method | Route | Content |
POST | /:uid/:pid | Put a product in a cart |
DELETE | /:uid/:pid | Delete a product from a cart |
DELETE | /:uid | Delete all product from a cart |
'쇼핑몰 구현 프로젝트' 카테고리의 다른 글
[쇼핑몰 구현 프로젝트] 06. 상품 관련 기능 (0) | 2024.06.23 |
---|---|
[쇼핑몰 구현 프로젝트] 05. 회원가입/로그인 (0) | 2024.06.23 |
[쇼핑몰 구현 프로젝트] 04. Backend, Database 틀잡기 (0) | 2024.06.22 |
[쇼핑몰 구현 프로젝트] 03. Frontend 틀잡기 (0) | 2024.06.22 |
[쇼핑몰 구현 프로젝트] 01. 시작 (0) | 2024.03.31 |