Deno First Program

Now, since we have successfully installed deno as per the steps covered in the previous section, let us run our deno first program.

The file welcome.ts is a typescript file with a simple console message “Welcome to Deno 🦕” and is hosted on the deno.land website.

We will directly run that file from our PowerShell command prompt.

$ deno run https://deno.land/std/examples/welcome.ts

Deno First Program

A. Deno.land File

Installing deno and Running our first program. Here, we are just running the welcome.ts file that exists on the deno.land website.

Getting Started with Deno

B. Local File

Let’s try to run a local Typescript file using deno.

File: helloworld.ts

console.log("Deno");
console.log("Hello World 🦕");

To run this we need to use one of the Deno commands:

deno run helloworld.ts

Deno First Program – Output

Deno
Hello World 🦕

In this section, we have run our first Deno program using files hosted on deno.land as well as on a local machine.

In the next section, we will be looking at the lifecycle of a Deno program.