diff options
-rw-r--r-- | examples/cat.ts | 5 | ||||
-rw-r--r-- | examples/http-file.ts | 4 | ||||
-rw-r--r-- | examples/http.ts | 1 |
3 files changed, 4 insertions, 6 deletions
diff --git a/examples/cat.ts b/examples/cat.ts index 1bb1c809a..a7d60b347 100644 --- a/examples/cat.ts +++ b/examples/cat.ts @@ -1,5 +1,6 @@ import { resolve } from "path"; const { write, stdout, file } = Bun; -const input = resolve(process.argv[process.argv.length - 1]); +const { argv } = process; -await write(stdout, file(input)); +const path = resolve(argv.at(-1)); +await write(stdout, file(path)); diff --git a/examples/http-file.ts b/examples/http-file.ts index f2c0773e8..3c1d67169 100644 --- a/examples/http-file.ts +++ b/examples/http-file.ts @@ -1,9 +1,7 @@ // Start a fast HTTP server from a function Bun.serve({ fetch(req) { - const url = new URL(req.url.substring(1), "file://" + import.meta.path); - const path = Bun.resolveSync(url.pathname, import.meta.path); - return new Response(Bun.file(path)); + return new Response("Hello World!"); }, // this is called when fetch() throws or rejects diff --git a/examples/http.ts b/examples/http.ts index 4d58f270f..4f52af2a6 100644 --- a/examples/http.ts +++ b/examples/http.ts @@ -19,7 +19,6 @@ Bun.serve({ // keyFile: './key.pem', port: 8080, // number or string - hostname: "localhost", // defaults to 0.0.0.0 }); // Start a fast HTTP server from the main file's export |