aboutsummaryrefslogtreecommitdiff
path: root/api/index.ts
diff options
context:
space:
mode:
authorAndrew Lee <andrew@alee14.me>2026-04-09 01:22:38 -0400
committerAndrew Lee <andrew@alee14.me>2026-04-09 01:22:38 -0400
commitf8b93cf133126b57d85d8a5fc424fc87ad2f4459 (patch)
tree53f16e8c0a2d65b1df1981292bdaa736ec1e1e76 /api/index.ts
downloadbnbmc-announcement-api-f8b93cf133126b57d85d8a5fc424fc87ad2f4459.tar.gz
bnbmc-announcement-api-f8b93cf133126b57d85d8a5fc424fc87ad2f4459.tar.bz2
bnbmc-announcement-api-f8b93cf133126b57d85d8a5fc424fc87ad2f4459.zip
Initial commit
Diffstat (limited to 'api/index.ts')
-rw-r--r--api/index.ts17
1 files changed, 17 insertions, 0 deletions
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}`);
+});