about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--README.md5
-rwxr-xr-xbun.lockbbin2354 -> 2042 bytes
-rw-r--r--package.json2
-rw-r--r--src/index.ts12
-rw-r--r--test/index.test.ts9
5 files changed, 18 insertions, 10 deletions
diff --git a/README.md b/README.md
index 3430625..34f3f42 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,9 @@
 
 ## Goals
 
-1. To be a near-drop-in replacement for Zola
-2. More indieweb features
+1. Static web server with prometheus-based analytics
+2. Dynamic web server capable of generating Zola-based websites
+3. More indieweb features
 
 ## Installing
 
diff --git a/bun.lockb b/bun.lockb
index 2ab9dd9..f724266 100755
--- a/bun.lockb
+++ b/bun.lockb
Binary files differdiff --git a/package.json b/package.json
index 96a8252..d0e61be 100644
--- a/package.json
+++ b/package.json
@@ -10,6 +10,6 @@
   },
   "type": "module",
   "dependencies": {
-    "siopao": "^0.4.0"
+    "serve-static-bun": "^0.5.3"
   }
 }
\ No newline at end of file
diff --git a/src/index.ts b/src/index.ts
index 8c0a3ba..59913b3 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1,10 +1,10 @@
-import { withHtmlLiveReload } from "bun-html-live-reload";
-import Siopao from "siopao";
+import { withHtmlLiveReload } from "bun-html-live-reload"
+import serveStatic from "serve-static-bun"
 
-const router = new Siopao();
-
-router.get("/status", () => new Response("OK"));
+const dir = Bun.argv.length > 2 ? Bun.argv[Bun.argv.length - 1] : "./"
 
 export default withHtmlLiveReload({
-  fetch: router.fetch.bind(router),
+  fetch: serveStatic(dir, {
+    dotfiles: "allow"
+  }),
 })
diff --git a/test/index.test.ts b/test/index.test.ts
index d82cb9e..8a32e47 100644
--- a/test/index.test.ts
+++ b/test/index.test.ts
@@ -4,6 +4,7 @@ import { expect, test, beforeAll, afterAll } from "bun:test"
 import app from "../src/index"
 
 const port = 33000;
+const base = `http://localhost:${port}/`;
 let server: Server
 
 beforeAll(async function () {
@@ -15,7 +16,13 @@ afterAll(function () {
 })
 
 test("/status returns 200 OK", async function () {
-  const res = await fetch(`http://localhost:${port}/status`)
+  const res = await fetch(new URL("/status", base))
   expect(res.status).toBe(200)
   expect(await res.text()).toBe("OK")
 })
+
+test("/ returns 200 and says Hello world", async function () {
+  const res = await fetch(base)
+  expect(res.status).toBe(200)
+  expect(await res.text()).toBe("Hello world")
+})