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/bun.lockb | Bin 0 -> 30656 bytes api/index.ts | 17 +++++++++++++++++ api/package.json | 14 ++++++++++++++ api/tsconfig.json | 12 ++++++++++++ 4 files changed, 43 insertions(+) create mode 100755 api/bun.lockb create mode 100644 api/index.ts create mode 100644 api/package.json create mode 100644 api/tsconfig.json (limited to 'api') diff --git a/api/bun.lockb b/api/bun.lockb new file mode 100755 index 0000000..52c0b95 Binary files /dev/null and b/api/bun.lockb 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"] + } +} -- cgit v1.2.3