generated at
denoはいいぞ2019
入れ方
bash
$ curl -fsSL https://deno.land/x/install/install.sh | sh
bashrc
export PATH=~/.deno/bin:${PATH}

確認
bash
$ deno -v deno: 0.3.2 v8: 7.4.238 typescript: 3.2.1

書いてみる
ts
import {StringReader} from "https://deno.land/std@v0.3.2/io/readers.ts" import open = Deno.open const {copy} = Deno async function main() { const f = await open("README.md", "w") await copy(f, new StringReader("Hello Deno!")) f.close() } main()

型定義とtsconfig.jsonを作る
bash
$ deno types > deno.d.ts
tsconfig.json
{ "compilerOptions": { "target": "esnext", "module": "esnext", "baseUrl": "/Users/keroxp/Library/Caches", "paths": { "https://*": ["./deno/deps/https/*"], "http://*": ["./deno/deps/http/*"] } } }
これでIntelliJ IDEAなら補完効くようになる

http server立ててみる
ts
import {listenAndServe} from "https://denopkg.com/keroxp/servest@v0.7.1/server.ts" async function main() { listenAndServe(":8888", async req => { await req.respond({ status: 200, headers: new Headers({ "content-type": "text/plain" }), body: new TextEncoder().encode("hello deno!") }) }); } main();