// Start a fast HTTP server from a function Bun.serve({ async fetch(req) { const { pathname } = new URL(req.url); if (!(pathname.startsWith("/https://") || pathname.startsWith("/http://"))) { return new Response("Enter a path that starts with https:// or http://\n", { status: 400, }); } const response = await fetch(req.url.substring("http://localhost:3000/".length), req.clone()); return new HTMLRewriter() .on("a[href]", { element(element) { element.setAttribute("href", "https://www.youtube.com/watch?v=dQw4w9WgXcQ"); }, }) .transform(response); }, // this is called when fetch() throws or rejects // error(err: Error) { // }, // this boolean enables the bun's default error handler // sometime after the initial release, it will auto reload as well development: process.env.NODE_ENV !== "production", // note: this isn't node, but for compatibility bun supports process.env + more stuff in process // SSL is enabled if these two are set // certFile: './cert.pem', // keyFile: './key.pem', port: 3000, // number or string }); on> Unnamed repository; edit this file 'description' to name the repository.
aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/node/types.zig (unfollow)
AgeCommit message (Expand)AuthorFilesLines
2023-09-01Fix run button starting cwd at /Gravatar Ashcon Partovi 1-0/+2
2023-09-01fix(runtime): fix dns_resolver crash (#4435)Gravatar dave caruso 3-17/+19
2023-09-01Fix background colorGravatar Ashcon Partovi 1-2/+3
2023-09-01Allow older versions of VSCodeGravatar Ashcon Partovi 2-6/+5
2023-09-01Fix README for extensionGravatar Ashcon Partovi 2-7/+12
2023-09-01Update VSCode extensionGravatar Ashcon Partovi 1-3/+4
2023-09-01Fix breakpoint on entry for extensionGravatar Ashcon Partovi 5-18/+15
2023-09-01Add Bun.canReload event to inspectorGravatar Ashcon Partovi 2-0/+17
2023-08-31JavaScript Debug Terminal == Bun TerminalGravatar Ashcon Partovi 1-0/+32
2023-08-31fix(runtime): `fs.cp` edge cases (#4439)Gravatar dave caruso 2-8/+44
2023-08-31only set initial debugger breakpoint once (#4441)Gravatar Dylan Conway 1-2/+11
2023-08-31Make breakpoints faster in VSCode extensionGravatar Ashcon Partovi 1-241/+327
2023-08-31`bun install` correctly join dependency URLs (#4421)Gravatar Julian 6-64/+243
2023-08-31get name if not provided in `FormData.append` (#4434)Gravatar Dylan Conway 4-5/+45
2023-08-31Fix vscode debug terminalGravatar Ashcon Partovi 1-21/+0