From cb027a6e926a7434d869572d8a2054a8f8261707 Mon Sep 17 00:00:00 2001 From: June Date: Thu, 15 Jan 2026 16:52:28 +1300 Subject: [PATCH] use compilerPath version --- src/pages/api/entry/date.ts | 9 +++++++++ src/utils/http.ts | 6 ++++++ tsconfig.json | 10 +++++++++- 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 src/pages/api/entry/date.ts create mode 100644 src/utils/http.ts diff --git a/src/pages/api/entry/date.ts b/src/pages/api/entry/date.ts new file mode 100644 index 0000000..a7673ca --- /dev/null +++ b/src/pages/api/entry/date.ts @@ -0,0 +1,9 @@ +import type { APIContext } from "astro"; +import { httpResponse } from "@util/response"; +import { getParams } from "@util/http"; + +export async function GET({ request }: APIContext) { + const params = getParams(request) + + return httpResponse({a: params}, 200) +} \ No newline at end of file diff --git a/src/utils/http.ts b/src/utils/http.ts new file mode 100644 index 0000000..992b5b0 --- /dev/null +++ b/src/utils/http.ts @@ -0,0 +1,6 @@ +export function getParams(request: Request) { + const params = request.url.split("?")[1] + const searchParams = new URLSearchParams(params); + const paramsDict = Object.fromEntries(searchParams.entries()); + return paramsDict +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 8bf91d3..2cdd2f0 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,5 +1,13 @@ { "extends": "astro/tsconfigs/strict", "include": [".astro/types.d.ts", "**/*"], - "exclude": ["dist"] + "exclude": ["dist"], + "compilerOptions": { + "baseUrl": ".", + "paths": { + "@component/*": ["src/components/*.astro"], + "@layout/*": ["src/layout/*.astro"], + "@util/*": ["src/utils/*"] + } + } }