From 48569b9c53da44657a0417f36927afe601ad46e4 Mon Sep 17 00:00:00 2001 From: alikia2x Date: Mon, 20 Jan 2025 03:01:43 +0800 Subject: [PATCH] fix: import in backend --- backend/route.ts | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/backend/route.ts b/backend/route.ts index c7e21cf..b523b0b 100644 --- a/backend/route.ts +++ b/backend/route.ts @@ -1,22 +1,22 @@ import { Express } from "express"; -import { completeGoogle } from "search-engine-autocomplete"; +import { completeGoogle } from "@alikia/search-complete"; export function configureBackendRoutes(app: Express) { - app.get('/api/v1/suggestion', async (req, res) => { - const query = req.query.q as string; - const t = parseInt(req.query.t as string || "0") || null; - let language = req.query.l as string || 'en-US'; - - try { - const data = await completeGoogle(query, language); - //logger.info({ type: "onesearch_search_autocomplete", query: query, data: data }); - res.json({ ...data, time: t }); - } catch (error) { - //logger.error({ type: "onesearch_search_autocomplete_error", error: error.message }); - res.status(500).json({ error: 'Internal Server Error' }); - } - }); - app.get("/api/v1/ping", async (_, res) => { - res.status(200).json({message: "pong"}); - }) -} \ No newline at end of file + app.get("/api/v1/suggestion", async (req, res) => { + const query = req.query.q as string; + const t = parseInt((req.query.t as string) || "0") || null; + let language = (req.query.l as string) || "en-US"; + + try { + const data = await completeGoogle(query, language); + // logger.info({ type: "onesearch_search_autocomplete", query: query, data: data }); + res.json({ ...data, time: t }); + } catch (error) { + // logger.error({ type: "onesearch_search_autocomplete_error", error: error.message }); + res.status(500).json({ error: "Internal Server Error" }); + } + }); + app.get("/api/v1/ping", async (_, res) => { + res.status(200).json({ message: "pong" }); + }); +}