DEV Community

D
D

Posted on

🍺 飲んでdenoいじってみた

nodejsの代わりになるのか?!deno(ディーノ)

$ brew install deno
$ deno -V
deno 1.0.0
Enter fullscreen mode Exit fullscreen mode

Welcome

$ deno run https://deno.land/std/examples/welcome.ts
Welcome to Deno 🦕
Enter fullscreen mode Exit fullscreen mode

url先見てみると console.log("Welcome to Deno 🦕");

Web server

$ vim server.ts

import { serve } from "https://deno.land/std@0.50.0/http/server.ts";
const s = serve({ port: 8000 });
console.log("http://localhost:8000/");
for await (const req of s) {
  req.respond({ body: "Hello World\n" });
}

$ deno run --allow-net server.ts
http://localhost:8000/
Enter fullscreen mode Exit fullscreen mode

Top comments (0)