From f8b93cf133126b57d85d8a5fc424fc87ad2f4459 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Thu, 9 Apr 2026 01:22:38 -0400 Subject: Initial commit --- api/index.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 api/index.ts (limited to 'api/index.ts') diff --git a/api/index.ts b/api/index.ts new file mode 100644 index 0000000..2fb7a08 --- /dev/null +++ b/api/index.ts @@ -0,0 +1,17 @@ +import express from 'express'; +import { Database } from "bun:sqlite"; + +const app = express(); +const port = process.env.PORT || 3000; +const db = new Database("../database.sqlite", { readonly: true }); + + +app.get('/', (req, res) => { + const query = db.prepare(`SELECT * FROM announcements ORDER BY created_at DESC`); + const result = query.all(); + res.send(result); +}); + +app.listen(port, () => { + console.log(`Server is running on port ${port}`); +}); -- cgit v1.2.3