DEV Community

loading...

🍺 飲んでdenoいじってみた

dongri profile image D ・1 min read

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

$ brew install deno
$ deno -V
deno 1.0.0

Welcome

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

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/

Discussion (0)

pic
Editor guide