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

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

박상호's avatar
213    
박상호 committed
14
const getSubCategory = (req, res) => {
이재연's avatar
0115    
이재연 committed
15
    
박상호's avatar
213    
박상호 committed
16

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

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

    next()
}


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