update
This commit is contained in:
22
src/pages/api/home.ts
Normal file
22
src/pages/api/home.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
// 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);
|
||||
}
|
||||
Reference in New Issue
Block a user