#4, добавила роутер /сategories

parent 3fa8cc31
const express = require("express");
const Category = require('../models/Category');
const createRouter = () => {
const router = express.Router();
router.get("/", async (req, res) => {
try {
res.send(await Category.find());
} catch (e) {
res.status(500).send(e)
}
});
return router;
};
module.exports = createRouter;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment