Added release type distinction to REST API.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const { fetchActor } = require('../actors');
|
||||
const { fetchActor, searchActors } = require('../actors');
|
||||
|
||||
async function fetchActorApi(req, res) {
|
||||
const actor = await fetchActor(req.params.actorId);
|
||||
@@ -13,6 +13,20 @@ async function fetchActorApi(req, res) {
|
||||
res.status(404).send({ actor: null });
|
||||
}
|
||||
|
||||
async function fetchActorsApi(req, res) {
|
||||
const query = req.query.query || req.query.q;
|
||||
|
||||
if (query) {
|
||||
const actors = await searchActors(query, req.query.limit);
|
||||
|
||||
res.send({ actors });
|
||||
return;
|
||||
}
|
||||
|
||||
res.send({ hint: 'specify a query or ID', actors: [] });
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
fetchActor: fetchActorApi,
|
||||
fetchActors: fetchActorsApi,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user