Deno 1.0 is out and publicly available now. We will try to get our hands on it and do a “Hello World” with Deno.
Main highlights of Deno
- Security at its core – Deno won’t access anything unless you allow it to and it includes file, network, or environment acess
- Out of the box TypeScript support
- Built in dependency inspector and code formatter
Let’s start with installation.
Installing Deno on Mac
Installation of Deno is pretty straightforward and instructions are available for every platform.
I am using Homebrew to install Deno on my Macbook Pro.
brew install deno
Once the installation is finished, lets verify and check version of Deno with following command
and we get following response which confirms the installation was successful
deno 1.2.0 v8 8.5.216 typescript 3.9.2
Hello World with Deno
Deno provides a REPL environment which can be used to execute quick commands. Just enter “deno” on your command prompt and you are good to go. Here is an example:
$ deno Deno 1.2.0 exit using ctrl+d or close() > console.log("Hello World") Hello World
Running script from an external file hellodeno.ts
console.log("Welcome to Deno 🦕");
Now execute this file with Deno
deno run hellodeno.ts
and we get following output
Welcome to Deno 🦕