DEV Community

Francesco Napoletano
Francesco Napoletano

Posted on

What is Deno? A 1 minute read

A 1 minute read post about Deno, the new kid in town. Is Node.js safe? Yes. Will you need to learn something new soon? Probably.

Deno is a project (written in Rust) which was created by the original creator of Node.js, Ryan Dahl and has recently gone 1.0 (currently 1.0.5).

It's defined on its website as:

A secure runtime for JavaScript and TypeScript

Why Deno runtime is secure?

In Deno by default your code can not:

  • Access the filesystem
  • Access the network
  • Access the environment

To allow this, you have to explicitly enable access by providing a flag when executing your code.

Deno is trying to bring the "disabled by default" nature of the browser, to the server-side. They do this by sandboxing your code mostly like a browser does.

Here is an example.

If you run this without using the --allow-net flag you'll see an error.

So to run this server you need to type deno run --allow-net server.ts

What are the features of Deno's runtime?

In Deno things are quite different from Node.js, in particular:

  • Dependency management (URLs instead of package.json, still somehow controversial for some people and some alternatives have been proposed)
  • A secure/audited standard library is available! https://deno.land/std (HTTP, websockets, UUID, DateTime, etc...)
  • Unlike Node.js, where once built/compiled you are given a set of files, with a single entry point, Deno will always give you a single executable binary (great for portability)
  • Built-In linting and much more is coming in version 1.1!

TypeScript by default

In Deno there’s no difference in running JavaScript code or TypeScript code. In Node.js, you have to configure your project to compile TypeScript and while improved, the process is not yet friendly for new users.

Done, I told you this was fast.

Check also the deno.land website! And this 50 minutes crash course about Deno

Top comments (0)