Skip to content

A getting started repository to know a bit more about Deno 🦕

License

Notifications You must be signed in to change notification settings

carlan/learning-deno

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Learning Deno

Deno logo

  • What is it?

    According to the website: A secure runtime for JavaScript and TypeScript.

    Deno is a simple, modern and secure runtime for JavaScript and TypeScript that uses V8 and is built in Rust.

    • Secure by default. No file, network, or environment access, unless explicitly enabled.
    • Supports TypeScript out of the box.
    • Ships only a single executable file.
    • Has built-in utilities like a dependency inspector (deno info) and a code formatter (deno fmt).
    • Has a set of reviewed (audited) standard modules that are guaranteed to work with Deno: deno.land/std
    • Scripts can be bundled into a single javascript file.
    • It doesn't have a package management.
    • Remote code is fetched and cached on first execution, and never updated until the code is run with the --reload flag. (So, this will still work on an airplane.)
    • Modules/files loaded from remote URLs are intended to be immutable and cacheable.
    • Created by the same author of Node.js (Ryan Dahl).

So if you're familiar with Node.js, Deno is very similar. Some will say it's the new Node.js.

  • Installation
$ curl -fsSL https://deno.land/x/install/install.sh | sh
$ deno completions bash > ~/.deno/deno.bash

Remember to edit your $HOME/.bashrc to add the Deno installation directory as the install script will say at the end.

Also, load the deno.bash with:

$ vim ~/.bashrc
(or similar file)

[...]
# Configuring deno installation dir
export DENO_INSTALL="/home/your-username/.deno"
export PATH="$PATH:$DENO_INSTALL/bin"
# Loading deno bash completion
if [ -f $DENO_INSTALL/deno.bash ]
then
  . $DENO_INSTALL/deno.bash
fi
[...]

Reload with source ~/.bashrc or close and open a new terminal window.

  • Hello Deno!

Download this repo and run in a terminal:

$ deno run hello-deno/main.ts
  • Google search

Download this repo and run in a terminal:

$ deno run --allow-net google-search/main.ts deno
  • Arnold Schwarzenegger Quotes

Download this repo and run in a terminal:

$ deno run --unstable --allow-read quotes/main.ts
  • Simple chat application

Download this repo and run in a terminal:

$ cd chat
$ deno run --unstable --allow-net --allow-env --allow-read main.ts

Open more than one private/incognito window to test it.

  • Using a file watcher

Install with:

$ deno install --allow-read --allow-run --allow-write -f --unstable https://deno.land/x/denon/denon.ts
$ denon -h
$ cd file-watcher
$ denon start

Find some file in file-watcher directory to change while the denon is running.

  • Create a sample web application
    • Pokemon API
      • Setup
      • CREATE a pokemon
      • GET a pokemon
      • LIST pokemons
      • UPDATE a pokemon
      • DELETE a pokemon

About

A getting started repository to know a bit more about Deno 🦕

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published