diff --git a/src/pages/icons/[...rest]/index.svg.ts b/src/pages/icons/[...rest]/index.svg.ts new file mode 100644 index 0000000..17cc766 --- /dev/null +++ b/src/pages/icons/[...rest]/index.svg.ts @@ -0,0 +1,7 @@ +import type { APIRoute } from 'astro'; +import { getSvgFile } from '~/components/Svg/utils'; + +export const GET: APIRoute = async ({ params }) => { + const html = getSvgFile(`icons/${params.rest}`); + return new Response(html, { headers: { 'content-type': 'image/svg+xml' } }); +}; diff --git a/src/pages/svg/[...rest]/index.svg.ts b/src/pages/svg/[...rest]/index.svg.ts new file mode 100644 index 0000000..1ce2ec7 --- /dev/null +++ b/src/pages/svg/[...rest]/index.svg.ts @@ -0,0 +1,7 @@ +import type { APIRoute } from 'astro'; +import { getSvgFile } from '~/components/Svg/utils'; + +export const GET: APIRoute = async ({ params }) => { + const html = getSvgFile(`svg/${params.rest}`); + return new Response(html, { headers: { 'content-type': 'image/svg+xml' } }); +};