all repos — archive/homestead @ 75041215b306fd5b7e7a86c2b0f35e5590010dea

My future indieweb platform

Log server info at startup
Alan Pearce alan@alanpearce.eu
Thu, 14 Sep 2023 11:39:56 +0200
commit

75041215b306fd5b7e7a86c2b0f35e5590010dea

parent

4ea39c5997bfea97b322d8b503e202db005317dd

1 files changed, 9 insertions(+), 3 deletions(-)

jump to
M src/index.tssrc/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 @@ }   },
 });
 
-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 @@ }     }
     return serveFile(file);
   },
-} satisfies Serve;
+});
+
+console.info(`Serving website on http://${server.hostname}:${server.port}/`);