feat: initial refactor to use marka as backend
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import { Handlers } from "$fresh/server.ts";
|
||||
import { getArticle } from "@lib/resource/articles.ts";
|
||||
import { json } from "@lib/helpers.ts";
|
||||
import { fetchResource } from "@lib/resources.ts";
|
||||
|
||||
export const handler: Handlers = {
|
||||
async GET(_, ctx) {
|
||||
const article = await getArticle(ctx.params.name);
|
||||
const article = await fetchResource(`articles/${ctx.params.name}`);
|
||||
return json(article);
|
||||
},
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@ import { createStreamResponse, isValidUrl } from "@lib/helpers.ts";
|
||||
import * as openai from "@lib/openai.ts";
|
||||
|
||||
import tds from "https://cdn.skypack.dev/turndown@7.2.0";
|
||||
import { Article, createArticle } from "@lib/resource/articles.ts";
|
||||
import { Article } from "@lib/resource/articles.ts";
|
||||
import { getYoutubeVideoDetails } from "@lib/youtube.ts";
|
||||
import {
|
||||
extractYoutubeId,
|
||||
@@ -170,7 +170,7 @@ async function processCreateArticle(
|
||||
|
||||
streamResponse.enqueue("writing to disk");
|
||||
|
||||
await createArticle(newArticle.id, newArticle);
|
||||
// await createArticle(newArticle.id, newArticle);
|
||||
|
||||
streamResponse.enqueue("id: " + newArticle.id);
|
||||
}
|
||||
@@ -210,7 +210,7 @@ async function processCreateYoutubeVideo(
|
||||
|
||||
streamResponse.enqueue("creating article");
|
||||
|
||||
await createArticle(newArticle.id, newArticle);
|
||||
// await createArticle(newArticle.id, newArticle);
|
||||
|
||||
streamResponse.enqueue("finished");
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Handlers } from "$fresh/server.ts";
|
||||
import { getAllArticles } from "@lib/resource/articles.ts";
|
||||
import { json } from "@lib/helpers.ts";
|
||||
import { fetchResource } from "@lib/resources.ts";
|
||||
|
||||
export const handler: Handlers = {
|
||||
async GET() {
|
||||
const movies = await getAllArticles();
|
||||
return json(movies);
|
||||
const articles = await fetchResource("articles");
|
||||
return json(articles?.content);
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user