Getting started with Deno

In this article, I'm going to show you how to get started with Deno - A secure runtime for JavaScript and TypeScript. We'll see Installation of Deno, Hello World program and setting up an http-server.

The What?

Deno is a secure runtime for Javascript & Typescript (right out of the box) just like Nodejs is a runtime for Javascript. Deno was created by same guy who created Nodejs i.e. Ryan Dahl.

Deno aims to improve what Ryan Dahl thinks he should've done with Nodejs like:

Deno aims to improve what's wrong with Nodejs
Things Deno offers out of the box

Installing Deno.

There are few options available on official site

We are gonna install it using Power-shell command:

iwr -useb | iex
Message after Deno is successfully installed

The Deno.exe  executable file is stored in C:\Users\<username>\.deno\bin\deno.exe by default.

In macOS or Linux $HOME/.local/bin

Following command will give info about Deno, V8 Engine & Typescript version installed on your machine.

deno --version
Deno versions

Hello World - Writing first program with Deno.

Open up your terminal and just type following:


will result into:

Executing a remote .ts file

What happened here is we execute a code present in a remote file, AWESOME!!

Content of

Now let's execute a local code:

Create a file inside "C:\deno" > index.ts (it could have .js extension for a javascript file)

Opening index.ts in Visual Studio Code

Now using terminal execute following command:

deno index.ts


deno index.js
Hello World!! with index.ts
Hello World!! with index.js

Setting up an http-server.

Deno provides an http-server i.e.[email protected]/http/server.ts

As provided on official website example, here's how you can create a running server on your machine:


import { serve } from "[email protected]/http/server.ts";

const s = serve({ port: 5000 });

console.log("Listening on http://localhost:5000/");

for await (const req of s) {
  req.respond({ body: "Hello World!!" });

just copy paste above code into your "index.ts" file and run it with following command.

deno -A index.ts
-A flag provides all the necessary permission for your app to run on your machine

GET request on server running on localhost:5000

Using Oak middle-ware with deno http-server.

Oak is a middleware framework for Deno's net server, more on this can be found on GitHub repo:

NOW let's create a GET & POST endpoint by altering our "index.ts" code with following:

import { Application, Router } from "";

const router = new Router();

router.get("/", context => {
  context.response.body = "Hello World!";
});"/", context => {
  context.response.body = "You have made a POST request!";

const app = new Application();


const server = app.listen({ port: 5000 });

console.log("Listening on http://localhost:5000/");
Here we are spinning of an http server with Oak


GET request on server running on localhost:5000
POST request on server running on localhost:5000

So, that was it regarding installing Deno, writing first 'Hello-World" program and setting up an http-server along with Oak middleware.

Deno – a better Node.js? | Krzysztof Piechowicz :

Deno Examples:

Oak Middleware:

Original article on:

Kushal Bhalaik

Kushal Bhalaik