diff --git a/server b/server index 9be25a1..3ea4b5d 100755 Binary files a/server and b/server differ diff --git a/src/index.ts b/src/index.ts index 380dec9..296b23d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -91,8 +91,20 @@ const app = new Elysia() }); }); -app.listen(3000, () => { - console.log( - `🦊 Elysia is running at ${app.server?.hostname}:${app.server?.port}`, - ); +const port = (() => { + let p = 3000; + for (let i = 0; i < Bun.argv.length; i++) { + if (Bun.argv[i] === '--port') { + const parsedPort = Number(Bun.argv[i + 1]); + if (!isNaN(parsedPort) && parsedPort > 0) { + p = parsedPort; + break; + } + } + } + return p; +})(); + +app.listen(port, () => { + console.log(`🦊 Elysia is running at ${app.server?.hostname}:${port}`); });