about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2023-09-14 11:39:56 +0200
committerAlan Pearce2023-09-15 19:24:52 +0200
commit75041215b306fd5b7e7a86c2b0f35e5590010dea (patch)
tree5a03dfe8b82d3fc48dc8d149f8480bf9fa8f7845
parent4ea39c5997bfea97b322d8b503e202db005317dd (diff)
downloadwebsite-75041215b306fd5b7e7a86c2b0f35e5590010dea.tar.lz
website-75041215b306fd5b7e7a86c2b0f35e5590010dea.tar.zst
website-75041215b306fd5b7e7a86c2b0f35e5590010dea.zip
Log server info at startup
-rw-r--r--src/index.ts12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/index.ts b/src/index.ts
index 69a7d86..2818682 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -129,7 +129,7 @@ function parseIfModifiedSinceHeader(header: string | null): number {
   return header ? new Date(header).getTime() + 999 : 0;
 }
 
-Bun.serve({
+const metricsServer = Bun.serve({
   port: 9091,
   fetch: async function (request) {
     const pathname = new URL(request.url).pathname;
@@ -142,7 +142,11 @@ Bun.serve({
   },
 });
 
-export default {
+console.info(
+  `Serving metrics on http://${metricsServer.hostname}:${metricsServer.port}/metrics`,
+);
+
+const server = Bun.serve({
   fetch: async function (request) {
     const pathname = new URL(request.url).pathname;
     const file = files.get(pathname);
@@ -183,4 +187,6 @@ export default {
     }
     return serveFile(file);
   },
-} satisfies Serve;
+});
+
+console.info(`Serving website on http://${server.hostname}:${server.port}/`);