17 lines
390 B
JavaScript
17 lines
390 B
JavaScript
|
'use strict';
|
||
|
|
||
|
const { fetchTags } = require('../tags');
|
||
|
|
||
|
async function fetchTagsApi(req, res) {
|
||
|
const tagId = typeof req.params.tagId === 'number' ? req.params.tagId : null;
|
||
|
const tagSlug = typeof req.params.tagId === 'string' ? req.params.tagId : null;
|
||
|
|
||
|
const tags = await fetchTags(tagId, tagSlug);
|
||
|
|
||
|
res.send(tags);
|
||
|
}
|
||
|
|
||
|
module.exports = {
|
||
|
fetchTags: fetchTagsApi,
|
||
|
};
|