mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-25 03:29:51 +01:00
feat: remote catalog
This commit is contained in:
1 parent
e7386ff766
commit
5e9aa99755
17 files changed
+109
-67
No files matched your search
@@ -0,0 +1,18 @@
|
||||
import type { APIRoute, GetStaticPaths, GetStaticPathsItem } from 'astro';
|
||||
import { catalog } from 'packages/website-ue/src/core/blitz/catalog';
|
||||
|
||||
export const getStaticPaths: GetStaticPaths = () => {
|
||||
const paths: GetStaticPathsItem[] = [];
|
||||
|
||||
for (const item in catalog.items) {
|
||||
paths.push({ params: { item } });
|
||||
}
|
||||
|
||||
return paths;
|
||||
};
|
||||
|
||||
export const GET: APIRoute<{}, { item: string }> = ({ params }) => {
|
||||
return new Response(catalog.get(params.item).encode(), {
|
||||
headers: { 'Content-Type': 'application/octet-stream' },
|
||||
});
|
||||
};
|
||||
Reference in new issue
Block a user