18 lines
455 B
TypeScript
18 lines
455 B
TypeScript
import { resolve } from "path"
|
|
|
|
const script = await Bun.file(resolve(import.meta.dir, "install.sh")).text()
|
|
|
|
Bun.serve({
|
|
port: parseInt(process.env.PORT || "3000"),
|
|
fetch(req) {
|
|
if (new URL(req.url).pathname === "/install") {
|
|
return new Response(script, {
|
|
headers: { "content-type": "text/plain" },
|
|
})
|
|
}
|
|
return new Response("toes", { status: 404 })
|
|
},
|
|
})
|
|
|
|
console.log(`Serving /install on :${Bun.env.PORT || 3000}`)
|