category.controller.js 552 Bytes
Newer Older
kusang96's avatar
kusang96 committed
1
2
3
4
import Category from "../schemas/Category.js";

const getCategory = async (req, res) => {
    try {
박상호's avatar
213    
박상호 committed
5
        const category = await Category.find({}, { _id: 0 })
kusang96's avatar
kusang96 committed
6
7
8
9
10
11
12
        res.json(category)
    } catch (error) {
        console.log(error)
        res.status(500).send('카테고리 검색 실패')
    }
}

박상호's avatar
213    
박상호 committed
13
const getSubCategory = (req, res) => {
박상호's avatar
asd    
박상호 committed
14

박상호's avatar
213    
박상호 committed
15

이재연's avatar
0115    
이재연 committed
16
17
}

박상호's avatar
213    
박상호 committed
18
19
20
const getsubId = (req, res, next, sub) => {
    // const subcategory = await category.find({"Dress"})
    console.log('sub=', sub)
이재연's avatar
0115    
이재연 committed
21
22
23
24
25

    next()
}


박상호's avatar
213    
박상호 committed
26
export default { getCategory, getsubId, getSubCategory }