Fix deno example app
This commit is contained in:
parent
d7a2109238
commit
c944013242
1 changed files with 8 additions and 11 deletions
|
@ -1,11 +1,5 @@
|
||||||
import { serve } from "https://deno.land/std@0.86.0/http/server.ts";
|
const bodyContent = `<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
const server = serve({ hostname: "0.0.0.0", port: 8080 });
|
|
||||||
console.log(`HTTP webserver running. Access it at: http://localhost:8080/`);
|
|
||||||
|
|
||||||
for await (const request of server) {
|
|
||||||
let bodyContent = `<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head lang=\"cs\">
|
<head lang=\"cs\">
|
||||||
<meta charset=\"UTF-8\">
|
<meta charset=\"UTF-8\">
|
||||||
<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">
|
<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">
|
||||||
|
@ -68,7 +62,10 @@ for await (const request of server) {
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>`;
|
</html>`;
|
||||||
|
|
||||||
request.respond({ status: 200, body: bodyContent });
|
console.log(`HTTP webserver running. Access it at: http://localhost:8080/`);
|
||||||
}
|
|
||||||
|
Deno.serve({ port: 8080 }, (_req) => {
|
||||||
|
return new Response(bodyContent);
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in a new issue