'use strict'; const { fetchTag, fetchTags } = require('../tags'); async function fetchTagApi(req, res) { const tag = await fetchTag(req.params.tagId); if (tag) { res.send({ tag }); return; } res.status(404).send({ tag: null }); } async function fetchTagsApi(req, res) { const tags = await fetchTags(req.query.limit); res.send({ tags }); } module.exports = { fetchTag: fetchTagApi, fetchTags: fetchTagsApi, };