Skip to content

Commit

Permalink
feat: use bunServe.url
Browse files Browse the repository at this point in the history
  • Loading branch information
aaydin-tr committed Apr 2, 2024
1 parent d25e0fb commit 71e3e10
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Errorlike, Server, TLSServeOptions } from "bun";
import { ErrorLike, Server } from "bun";
import { Config, Context, Controller, Group, Route } from ".";
import fs from "fs";

Expand Down Expand Up @@ -77,11 +77,8 @@ export function startupMessage(
const { version } = JSON.parse(
fs.readFileSync(import.meta.dir + "/../package.json", "utf-8")
);

const schema = (config.serveOptions as TLSServeOptions).tls?.key
? "https"
: "http";
const hostMsg = `${schema}://${bunServe.hostname}:${bunServe.port}`;

const hostMsg = `${bunServe.url.toString()}`;
const handlersMsg = `Handlers ...... ${routes.length}`;
const pidMsg = `PID ...... ${process.pid}`;
const handlerMsgAndPidMsg = `${handlersMsg} ${pidMsg}`;
Expand Down Expand Up @@ -210,7 +207,7 @@ export function getRoutesFromControllers(
}, []);
}

export function defaultErrorHandler(err: Errorlike) {
export function defaultErrorHandler(err: ErrorLike) {
return new Response(
JSON.stringify({
message: err?.message,
Expand Down

0 comments on commit 71e3e10

Please sign in to comment.