aboutsummaryrefslogtreecommitdiff
path: root/src/controllers/animeSearchSuggestion.controller.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/controllers/animeSearchSuggestion.controller.ts')
-rw-r--r--src/controllers/animeSearchSuggestion.controller.ts31
1 files changed, 0 insertions, 31 deletions
diff --git a/src/controllers/animeSearchSuggestion.controller.ts b/src/controllers/animeSearchSuggestion.controller.ts
deleted file mode 100644
index ed8784f..0000000
--- a/src/controllers/animeSearchSuggestion.controller.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import createHttpError from "http-errors";
-import { type RequestHandler } from "express";
-import { scrapeAnimeSearchSuggestion } from "../parsers/index.js";
-import { type AnimeSearchSuggestQueryParams } from "../types/controllers/index.js";
-
-// /anime/search/suggest?q=${query}
-const getAnimeSearchSuggestion: RequestHandler<
- unknown,
- Awaited<ReturnType<typeof scrapeAnimeSearchSuggestion>>,
- unknown,
- AnimeSearchSuggestQueryParams
-> = async (req, res, next) => {
- try {
- const query: string | null = req.query.q
- ? decodeURIComponent(req.query.q as string)
- : null;
-
- if (query === null) {
- throw createHttpError.BadRequest("Search keyword required");
- }
-
- const data = await scrapeAnimeSearchSuggestion(query);
-
- res.status(200).json(data);
- } catch (err: any) {
- console.error(err);
- next(err);
- }
-};
-
-export default getAnimeSearchSuggestion;