/
yeliseyevv
/
AudioLibrary
Обзор
Документация
Войти
/
yeliseyevv
/
AudioLibrary
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
server/controllers/categoryController.js
18 строк
448 B
Viktor
Загрузка на GitHub AudioLibrary Final
10 мар 2023, 23:25
10 мар 2023, 23:25
f3b1327
Код
Авторство
О чём код?
const {Category} = require('../models/models') const ApiError = require('../error/ApiError'); class CategoryController { async create(req, res) { const {name} = req.body const category = await Category.create({name}) return res.json(category) } async getAll(req, res) { const categories = await Category.findAll() return res.json(categories) } } module.exports = new CategoryController()