DENO: A “Better and Secure” NodeJS

const node = `node`.split(”).sort().join(”);
//Output of node is “deno”

Deno is a simple, modern and secure runtime for JavaScript and TypeScript that uses V8 and is built in Rust. (As per https://deno.land/)

Deno created by Ryan Dahl – the original creator of Node.js. In 2019, JavaScript lacked several features that would have been useful for Node.js according to Dahl. Deno intended to fix design problems in Node.js.

Node.js design shortcomings

According to Dahl, who after all creator of both Node.js and Deno, Node.js suffers from three major design issues?

  • a poorly designed module system, with centralized distribution;
  • lots of legacy APIs that must be supported;
  • And a lack of security.
Deno fixes all three design problems

 

So what does Deno has to offer?

  1. TypeScript out of the box
    • Deno is integrated to run Typescript files by default. Typescript can compiled to JS using Babel or TS compiler. But now since TS is the main language, there is no overhead of compilation.
    • When you are using JS in Deno, TS compiler will not invoked which prevents unnecessary bloats.
  2. Importing from URL
    • When you are using Node.js you have to download package from NPM but in case of Deno you don’t have download packages, instead of that you have to import from URL
    • Example: import * as log from “https://deno.land/std/log/mode.ts”
    • After importing above Deno will cache into local memory when you run code for first time
    • Deno website provides code hosting to 3rd party packages : https://deno.land/x
  3. Async Support
    • Deno is Async by default. This means you don’t have to create Async wrapper functions just to use await.Deno example

 

How to install Deno?

  • With Shell
$ curl -fsSL https://deno.land/x/install/install.sh | sh
  • With PowerShell
$ iwr https://deno.land/x/install/install.ps1 -useb | iex

Once this is done, you will have access to the deno command. Here’s the help that you can get using
deno –help

For example clone my repository: https://github.com/theromie/deno-demo