Basic Setup for Deno!

Vuelancer - Jun 12 '20 - - Dev Community
  • Deno is a simple, modern and secure runtime for JavaScript and TypeScript that uses V8 and is built in Rust.

  • You can easily understand the deno application (REST API, etc.) if you know how nodejs is working in those.

Alt Text

I made a youtube video for getting stared in deno.


Install Deno

  • For windows, I prefer chocolatey
$ choco install deno
Enter fullscreen mode Exit fullscreen mode
  • For more options, You can visit their official documentation website https://deno.land

Getting Started


  • You can create applications like REST API as like in nodejs, Backend application for your full-stack application.

  • How to run your application?

$ deno run <app.js | app.ts>
Enter fullscreen mode Exit fullscreen mode
  • How to install global packages like denon?

Denon is exactly like a nodemon for deno.

$ deno install --allow-read --allow-run --allow-write --allow-net -f --unstable https://deno.land/x/denon/denon.ts
Enter fullscreen mode Exit fullscreen mode

(Link can be changing if you are installing other packages)

Simple Example for creating http server in deno!

import { serve } from "https://deno.land/std@0.56.0/http/server.ts";
const s = serve({ port: 8080 });
console.log("http://localhost:8080/");
for await (const req of s) {
  req.respond({ body: "It's my Deno world!" });
}
Enter fullscreen mode Exit fullscreen mode
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .