aboutsummaryrefslogtreecommitdiff
path: root/api
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
downloadbnbmc-announcement-api-f8b93cf133126b57d85d8a5fc424fc87ad2f4459.tar.gz
bnbmc-announcement-api-f8b93cf133126b57d85d8a5fc424fc87ad2f4459.tar.bz2
bnbmc-announcement-api-f8b93cf133126b57d85d8a5fc424fc87ad2f4459.zip
Initial commit
Diffstat (limited to 'api')
-rwxr-xr-xapi/bun.lockbbin0 -> 30656 bytes
-rw-r--r--api/index.ts17
-rw-r--r--api/package.json14
-rw-r--r--api/tsconfig.json12
4 files changed, 43 insertions, 0 deletions
diff --git a/api/bun.lockb b/api/bun.lockb
new file mode 100755
index 0000000..52c0b95
--- /dev/null
+++ b/api/bun.lockb
Binary files differ
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}`);
+});
diff --git a/api/package.json b/api/package.json
new file mode 100644
index 0000000..c9b6a1e
--- /dev/null
+++ b/api/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "api",
+ "version": "1.0.0",
+ "main": "index.js",
+ "license": "MIT",
+ "dependencies": {
+ "express": "^5.2.1"
+ },
+ "devDependencies": {
+ "@types/bun": "^1.3.11",
+ "@types/express": "^5.0.6",
+ "@types/node": "^25.5.2"
+ }
+}
diff --git a/api/tsconfig.json b/api/tsconfig.json
new file mode 100644
index 0000000..f737fec
--- /dev/null
+++ b/api/tsconfig.json
@@ -0,0 +1,12 @@
+{
+ "compilerOptions": {
+ "target": "ES2020", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
+ "module": "NodeNext", /* Specify what module code is generated. */
+ "moduleResolution": "NodeNext",
+ "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
+ "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
+ "strict": true, /* Enable all strict type-checking options. */
+ "skipLibCheck": true, /* Skip type checking all .d.ts files. */
+ "types": ["node", "bun"]
+ }
+}