Listen on 0.0.0.0
This commit is contained in:
parent
175ee5018f
commit
a8a6d544e3
|
@ -1,9 +1,13 @@
|
|||
#!/usr/bin/env -S deno run --allow-run --allow-net
|
||||
// Automated bundle server
|
||||
|
||||
import { serve } from "https://deno.land/std/http/server.ts";
|
||||
import { bool } from "https://code.thunderk.net/typescript/functional/raw/1.0.0/all.ts";
|
||||
|
||||
const server = serve({ port: 8000 });
|
||||
async function serveBundles() {
|
||||
const listen = { hostname: "0.0.0.0", port: 8000 };
|
||||
const server = serve(listen);
|
||||
console.log(`Serving bundles on ${listen.hostname}:${listen.port} ...`);
|
||||
for await (const req of server) {
|
||||
const params = req.url.split("/").filter(bool);
|
||||
const lib = params[0] || "all";
|
||||
|
@ -22,3 +26,6 @@ for await (const req of server) {
|
|||
req.respond({ body: `console.error("Failed to bundle ${path}");` });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
await serveBundles();
|
||||
|
|
Loading…
Reference in New Issue