Follow to the official landig page.
curl -fsSL https://deno.land/x/install/install.sh | sh
Here is first_script.ts
.
var msg:string = "Hello world"
console.log(msg)
This is written in TypeScript.
We can run the script by deno {{ your program name}}
.
Here is an example and result.
deno first_script.ts
Compile file:///Users/atlex/test/first_script.ts
Hello World
Here is the program hellow_serve.ts
.
import { serve } from "https://deno.land/std@v0.40.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" });
}
v0.42.0
doesn’t work fine.Run with following command.
The only difference from “Hello world sample” is the option --allow-net
.
deno --allow-net hello_server.ts
You can access your page via http://localhost:8080
.
deno upgrade