feat: initial refactor to use marka as backend

This commit is contained in:
Max Richter
2025-10-28 20:15:23 +01:00
parent 0beb3b1071
commit f680b5f832
39 changed files with 245 additions and 1012 deletions

View File

@@ -1,6 +1,6 @@
import { Handlers, PageProps } from "$fresh/server.ts";
import { MainLayout } from "@components/layouts/main.tsx";
import { Article, getAllArticles } from "@lib/resource/articles.ts";
import { Article } from "@lib/resource/articles.ts";
import { KMenu } from "@islands/KMenu.tsx";
import { Grid } from "@components/Grid.tsx";
import { IconArrowLeft } from "@components/icons.tsx";
@@ -9,12 +9,14 @@ import { parseResourceUrl, searchResource } from "@lib/search.ts";
import { GenericResource } from "@lib/types.ts";
import { ResourceCard } from "@components/Card.tsx";
import { Link } from "@islands/Link.tsx";
import { fetchResource } from "@lib/resources.ts";
export const handler: Handlers<
{ articles: Article[] | null; searchResults?: GenericResource[] }
> = {
async GET(req, ctx) {
const articles = await getAllArticles();
const { content: articles } = await fetchResource("articles");
const searchParams = parseResourceUrl(req.url);
const searchResults = searchParams &&
await searchResource({ ...searchParams, types: ["article"] });