Cleanup AI slop and simplify db interface
This commit is contained in:
@@ -4,7 +4,7 @@ import { renderToString } from "react-dom/server";
|
||||
|
||||
import matter from 'gray-matter';
|
||||
import { marked } from 'marked';
|
||||
import { addToDatabase } from "../src/db/index";
|
||||
import { dbConnection } from "../src/db/index";
|
||||
|
||||
import { AppShell } from "../src/frontend/AppShell";
|
||||
import { Post } from "../src/frontend/pages/post";
|
||||
@@ -38,7 +38,7 @@ const markdownLoader: BunPlugin = {
|
||||
readingTime: data.readingTime || `${Math.ceil(content.split(/\s+/).length / 200)} min read`
|
||||
};
|
||||
const renderedHtml = renderToString(<AppShell><Post meta={meta} children={bodyHtml} /></AppShell>);
|
||||
addToDatabase(args.path, meta, bodyHtml); // Load the post to the database for dynamic querying
|
||||
dbConnection.addPost(args.path, meta, bodyHtml); // Load the post to the database for dynamic querying
|
||||
|
||||
// JSX Approach
|
||||
return {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import matter from 'gray-matter';
|
||||
import { marked } from 'marked';
|
||||
import { addToDatabase } from "../src/db/index";
|
||||
import { dbConnection } from "../src/db";
|
||||
|
||||
// When the server starts, import all the blog post metadata into the database
|
||||
// Executed on startup because it's included in <root> ./bunfig.toml
|
||||
@@ -22,7 +22,7 @@ import { addToDatabase } from "../src/db/index";
|
||||
}
|
||||
|
||||
const bodyHtml = await marked.parse(processedContent);
|
||||
addToDatabase(route, data, bodyHtml);
|
||||
dbConnection.addPost(route, data, bodyHtml);
|
||||
}
|
||||
|
||||
console.log('Posts have been imported into db');
|
||||
|
||||
Reference in New Issue
Block a user