const hostname = "0.0.0.0";
const port = 8080;
const listener = Deno.listen({ hostname, port });
console.log(`Listening on ${hostname}:${port}`);
for await (const conn of listener) {
Deno.copy(conn, conn);
}
當(dāng)這個程序啟動時,它會拋出一個沒有網(wǎng)絡(luò)權(quán)限的錯誤。
$ deno run https://deno.land/std/examples/echo_server.ts
error: Uncaught PermissionDenied: network access to "0.0.0.0:8080", run again with the --allow-net flag
? $deno$/dispatch_json.ts:40:11
at DenoError ($deno$/errors.ts:20:5)
...
更多建議: