ADD: get all category handler

This commit is contained in:
MohammadHMazarei
2024-12-29 19:45:20 +03:30
parent 6e6c409201
commit 67b0e810f5
+14
View File
@@ -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,
})
})