1
0
Fork 0
mirror of https://github.com/kou029w/_.git synced 2025-01-30 22:08:02 +00:00

update deno example

This commit is contained in:
Nebel 2021-11-24 17:53:54 +09:00
parent fb81affdc3
commit 58d3e74c02
6 changed files with 24 additions and 5650 deletions

6
deno/.vscode/settings.json vendored Normal file
View file

@ -0,0 +1,6 @@
{
"deno.enable": true,
"deno.lint": true,
"deno.unstable": false,
"deno.importMap": "importmap.json"
}

7
deno/app.ts Normal file
View file

@ -0,0 +1,7 @@
import { Handler, ServeInit, serve } from "http/server.ts";
const handler: Handler = () => new Response("Hello World\n");
const options: ServeInit = { addr: "localhost:8080" };
serve(handler, options);
console.log(`Server running on http://${options.addr}`);

5
deno/importmap.json Normal file
View file

@ -0,0 +1,5 @@
{
"imports": {
"http/": "https://deno.land/std@0.115.1/http/"
}
}

6
deno/scripts.yml Normal file
View file

@ -0,0 +1,6 @@
# yaml-language-server: $schema=https://deno.land/x/denon@2.4.10/schema.json
importmap: importmap.json
scripts:
start:
cmd: "deno run app.ts"
allow: [net]

File diff suppressed because it is too large Load diff

View file

@ -1,10 +0,0 @@
import { serve } from "https://deno.land/std@0.56.0/http/server.ts";
async function main() {
const port = 8000;
console.log(`http://localhost:${port}/`);
for await (const req of serve({ port })) {
req.respond({ body: "Hello World\n" });
}
}
main();