20 lines
457 B
JavaScript
20 lines
457 B
JavaScript
'use strict';
|
|
|
|
const { fetchActors } = require('../actors');
|
|
|
|
async function fetchActorsApi(req, res) {
|
|
const actorId = typeof req.params.actorId === 'number' ? req.params.actorId : null;
|
|
const actorSlug = typeof req.params.actorId === 'string' ? req.params.actorId : null;
|
|
|
|
const actors = await fetchActors({
|
|
id: actorId,
|
|
slug: actorSlug,
|
|
});
|
|
|
|
res.send(actors);
|
|
}
|
|
|
|
module.exports = {
|
|
fetchActors: fetchActorsApi,
|
|
};
|