bash$ curl -fsSL https://deno.land/x/install/install.sh | sh
bashrcexport PATH=~/.deno/bin:${PATH}
bash$ deno -v
deno: 0.3.2
v8: 7.4.238
typescript: 3.2.1
tsimport {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()
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/*"]
}
}
}
tsimport {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();