What’s Deno?


So the apparent question is what the hell is Deno? Alright then, sit back and relax and let me explain it to you guys.

DENO is an anagram of NODE! Deno is a secure runtime for JavaScript and TypeScript that is based on the V8 JavaScript engine and the Rust programming language. It was created by Ryan Dahl, original creator of Node.js, and is focused on productivity. It was announced by Dahl in 2018 during his talk “10 Things I Regret About Node.js

Now, this doesn’t mean that Node.js is going to go away. No sir! It’ll still be used. However, Newer applications would most probably use Deno, since it doesn’t have the shortcomings of Node.js.

Deno uses V8 and is built in Rust.

  1. Secure by default. No file, network, or environment access, unless explicitly enabled.
  2. Supports TypeScript out of the box.
  3. Ships only a single executable file.
  4. Has built-in utilities like a dependency inspector (deno info) and a code formatter (deno fmt).
  5. Has a set of reviewed (audited) standard modules that are guaranteed to work with Deno

Installation

Deno ships as a single executable with no dependencies. You can install it using the installers below, or download a release binary from the releases page.

Shell (Mac, Linux):

$curl -fsSL https://deno.land/x/install/install.sh | sh

PowerShell (Windows):

$iwr https://deno.land/x/install/install.ps1 -useb | iex

Homebrew (Mac):

$brew install deno

Chocolatey (Windows):

$choco install deno

Scoop (Windows):

$scoop install deno

Build and install from source using Cargo

$cargo install deno

Getting Started

Try running a simple program:

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

Or a more complex one:

import { serve } from "https://deno.land/std@0.57.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" });}

What DENO’s GOALS are?

  • Only ship a single executable (deno).
  • Provide Secure Defaults
    • Unless specifically allowed, scripts can’t access files, the environment, or the network.
  • Browser compatible: The subset of Deno programs which are written completely in JavaScript and do not use the global Deno namespace (or feature test for it), ought to also be able to be run in a modern web browser without change.
  • Provide built-in tooling like unit testing, code formatting, and linting to improve developer experience.
  • Does not leak V8 concepts into user land.
  • Be able to serve HTTP efficiently

Comparison to Node.js

  • Deno does not use npm
    • It uses modules referenced as URLs or file paths
  • Deno does not use package.json in its module resolution algorithm.
  • All async actions in Deno return a promise. Thus Deno provides different APIs than Node.
  • Deno requires explicit permissions for file, network, and environment access.
  • Deno always dies on uncaught errors.
  • Uses “ES Modules” and does not support require(). Third party modules are imported via URLs: import * as log from "https://deno.land/std/log/mod.ts";

Node.js developers and companies using it should not be worried by Deno. It’s not here to make you guys obsolete. It’s just another runtime environment, which is created by the same guy. Moreover, Deno is in a very nascent stage as of now. It’ll take time for it to mature and grow and be any threat to Node.js.

In the nutshell it looks like a very exciting runtime environment to me. I’m going to definitely give it a shot. How ’bout you?


Follow us on our Official Social Media Platforms.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s