WIP: build attempted

This commit is contained in:
2024-02-22 23:42:04 +11:00
parent a1cba242e9
commit 5c8a3f56dd
5 changed files with 56 additions and 37 deletions

View File

@@ -1,9 +1,9 @@
import { promisePool } from "@/backend/db";
import { getPromisePool } from "@/backend/db";
import {RowDataPacket} from "mysql2";
async function query() {
try {
const [rows, fields] = await promisePool.query<RowDataPacket[]>('select slug from post limit 1;')
const [rows, fields] = await getPromisePool().query<RowDataPacket[]>('select slug from post limit 1;')
return(rows[0]['slug'] as string)
} catch (e) {
console.log(e)
@@ -11,11 +11,18 @@ async function query() {
}
}
export default async function DbCheck() {
export default async function DbCheck({ searchParams }: { searchParams: { [key: string]: string | string[] | undefined }}) {
let flag = "empty";
if (typeof searchParams["flag"] === 'string') {
flag = searchParams["flag"]
}
return(
<div className={`flex flex-col`}>
<p>Env: { process.env.MYSQL_HOST }</p>
<p>Result: { await query() }</p>
<p>Flag: { flag }</p>
</div>
)
}