WIP: build attempted
This commit is contained in:
@@ -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>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user