Hello Deno!

A first look at this new “secure runtime for JavaScript and TypeScript” and how it differs from Node.js

A drawing of a cute dinosaur on top of a small planet.

What is it?

Behind the scenes

Run Environment, hello world and goodbye package.json!

import { serve } from "https://deno.land/std@0.59.0/http/server.ts";const s = serve({ port: 8000 });for await (const req of s) {    req.respond({ body: "Hello World\n" });}
const express = require(‘express’)
const app = express()
const port = 3000
app.get(‘/’, (req, res) => res.send(‘Hello World!’))app.listen(port, () => console.log(`Listening at http://localhost:${port}`))
const response = await fetch('https://some.url');
const data = await response.json();
deno run --allow-net index.ts
A drawing of some cute dinosaurs silhouetted in front of a green leafy background.

Node.js Versus Deno recap

In the meantime let’s recap some differences:

  • Node uses npm package and node modules. Deno doesn’t use npm anymore, it uses modules referenced as URLs or file paths, it includes a built-in package manager for resource fetching.
  • Node uses package.json in order to make a reference to its libraries installed. Deno does not use package.json in its module resolution algorithm.
  • Deno requires permissions for file, network, and environment access.
  • Deno uses “ES Modules” and does not support require(). Deno can import third party modules from any location on the web, like GitHub, a personal webserver, or a CDN.
  • All async actions in Deno return a promise.
  • It supports Typescript out of the box, therefore redesigns API to utilize Promises, ES6 and TypeScript features



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Laura Morinigo

Google Developer Expert @Firebase, advocate, mentor, #VoiceFirst Enthusiast. Here to share thoughts and adventures. From Argentina to the world.