'use strict'; const router = require('express').Router(); const search = require('>/controller/search'); // Step 1: fuzzy query -> a few TMDB title candidates( with posters) to confirm. router.get('/title', async function(req, res, next){ try{ res.json({results: await search.tmdbSearch(req.query.q)}); }catch(error){ next(error); } }); // Step 2: confirmed title -> TPB search + LLM-curated release options. router.post('/releases', async function(req, res, next){ try{ res.json(await search.findReleases(req.body.tmdbId, req.body.mediaType)); }catch(error){ next(error); } }); module.exports = router;