Files
jkhsakha-web/src/pages/api/home.ts
2026-02-11 22:30:04 +09:00

23 lines
671 B
TypeScript

// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import { connection } from "@/lib/duckdb";
import type { NextApiRequest, NextApiResponse } from "next";
// Gets the page that is set as home page
export default async function handler(
req: NextApiRequest,
res: NextApiResponse,
) {
const result = await connection.run(`
SELECT p.*
FROM wp_posts p
WHERE p.ID = (
SELECT option_value
FROM wp_options
WHERE option_name = 'page_on_front'
LIMIT 1
)
LIMIT 1;`)
const rows = await result.getRowObjectsJson()
res.status(200).json(rows);
}