traxxx/src/web/tags.js

20 lines
479 B
JavaScript
Raw Normal View History

'use strict';
const { fetchTags } = require('../tags');
async function fetchTagsApi(req, res) {
const tagId = typeof req.params.tagId === 'number' ? req.params.tagId : undefined; // null will literally include NULL results
const tagSlug = typeof req.params.tagId === 'string' ? req.params.tagId : undefined;
const tags = await fetchTags({
id: tagId,
slug: tagSlug,
});
res.send(tags);
}
module.exports = {
fetchTags: fetchTagsApi,
};