Deno QS

By pjain      Published May 22, 2020, 10:33 p.m. in blog Programming   

Part of Series - Javascript Series

Deno Quickstart

Setup

  • Install and then copy suggested export line and add to your ~/.bash_profile curl -fsSL https://deno.land/x/install/install.sh | sh

REPL

$ deno
> console.log("hello");  // hello
> ^d // did not work? exit

VSCode IDE Quickstart

  • install vscode
  • Create a workspace
  • Add a folder for root of base of examples in it...
  • Install the Deno plugin by justjavac - this supports typescript and highlighting and provides intellisense in TypeScript files within any editors that uses TypeScript to power their language features. It uses the VS Code version of Typescript (must be version >2.3).
  • Also install deno plugin by axetroy. In your workspace folder create .vscode/settings.json file and add following config { "deno.enable": true, }

  • Then tryout one of examples

Running deno commands

   $ deno run https://deno.land/std/examples/welcome.ts

EX1: Hello-World CLI

EX2: Hello Web Server with Routes

  • Note the server code is imported from a remote url. But it is cached locally, and not refetched, so second time it will run properly.

    import { serve } from "https://deno.land/std@0.52.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\n" }); }

Deno IDEs - VSCode/TS BPR


0 comments

There are no comments yet

Add new comment

Similar posts

Deno Resources

Deno AR, Versions, Review

Time series Analytics and Charting

DNS, Domains, Multi-Tenancy, Django focus ------