aboutsummaryrefslogtreecommitdiff
path: root/examples/http-file.ts
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-04-06 06:14:04 -0700
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2022-04-06 06:14:04 -0700
commit69653729f0a8e0dd2efcb7ff48e061c9b541c051 (patch)
tree7bc3aedbb8703ca0155991bb1fb73a6b09d0b158 /examples/http-file.ts
parent81eb47de0eb08081ed0677b71aa47e9a2b473cab (diff)
downloadbun-69653729f0a8e0dd2efcb7ff48e061c9b541c051.tar.gz
bun-69653729f0a8e0dd2efcb7ff48e061c9b541c051.tar.zst
bun-69653729f0a8e0dd2efcb7ff48e061c9b541c051.zip
tweak examples
Diffstat (limited to 'examples/http-file.ts')
-rw-r--r--examples/http-file.ts4
1 files changed, 1 insertions, 3 deletions
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