Home
 
  

Getting started with deno on windows

May 30, 2020

Deno is developed for removing shortcomings of Nodejs.

Deno is a new JavaScript framework that supports TypeScript out of the box and this is based on the V8 JavaScript engine. Deno framework is written using Rust programming language. It was created by Ryan Dahl, creator of Node.js

  • Support ES Module as the default module system
  • Uses URLs for loading local or remote dependencies, and Install on the first run means it doesn't require the package manager
  • Supports TypeScript out of the box, using a snapshotted TypeScript compiler with caching mechanisms.
  • Secure by default. No file, network, or environment access, unless explicitly enabled.
  • Ships only a single executable file.
  • Redesigned API to utilize Promises, ES6 and TypeScript features.
  • Optimized core API size, while providing a large standard library with no external dependencies.

Install deno on windows

  • Open PowerShell as administrator
  • Run the following command iwr https://deno.land/x/install/install.ps1 -useb | iex

Deno is installed on your system you can start writing the first program

Hello World with deno

  • Create an index.ts file
  • Paste following code in this and save file
    import { serve } from "https://deno.land/std@0.54.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" });
    }
  • Open command prompt or PowerShell and navigate to the directory of index.ts
  • Run the following command

>deno run --allow-net index.ts

  • open browser and pen localhost:8000 in the address bar

for further learning and more examples, you can refer official manual.

Govind Malviya

Govind Malviya

Director of Product Development @LoginRadius

 

© 2020