ADD: get all category handler
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
const catchAsync = require('../../globalErrorHandler/catchAsync')
|
||||
const AppError = require('../../globalErrorHandler/AppError')
|
||||
const Category = require('./categoryModel')
|
||||
const categoryService = require('./categoryService')
|
||||
|
||||
exports.getAllCategories = catchAsync(async (req, res, next) => {
|
||||
const categories = await categoryService.getAllCategories()
|
||||
|
||||
res.status(200).json({
|
||||
status: 'success',
|
||||
results: categories.length,
|
||||
data: categories,
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user