mirror of
https://github.com/hpware/news-analyze.git
synced 2025-06-23 13:04:23 +00:00
Some checks are pending
Build and Push Beta Image / build-and-push (push) Waiting to run
11 lines
381 B
TypeScript
11 lines
381 B
TypeScript
import sql from "~/server/components/postgres";
|
|
export default defineEventHandler(async (event) => {
|
|
const articles = await sql`
|
|
SELECT * FROM news_articles;
|
|
`;
|
|
setHeaders(event, {
|
|
"Content-Type": "application/json",
|
|
"Content-Disposition": `attachment; filename="news-articles-export-${new Date().toISOString().split("T")[0]}.json"`,
|
|
});
|
|
return articles;
|
|
});
|