13 lines
400 B
TypeScript
13 lines
400 B
TypeScript
import { RowDataPacket } from "mysql2";
|
|
import { getPromisePool } from "@/backend/db";
|
|
|
|
export async function getPost(slug: string): Promise<string> {
|
|
try {
|
|
const [rows, fields] = await getPromisePool().query<RowDataPacket[]>(
|
|
'select content from post where slug = ?', [slug])
|
|
return rows[0]['content']
|
|
} catch (e) {
|
|
console.log(e)
|
|
throw e
|
|
}
|
|
} |