• Complain

Jana Bergant - Deno - A Complete Guide to Programming With Deno

Here you can read online Jana Bergant - Deno - A Complete Guide to Programming With Deno full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2020, publisher: leanpub.com, genre: Computer. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

No cover
  • Book:
    Deno - A Complete Guide to Programming With Deno
  • Author:
  • Publisher:
    leanpub.com
  • Genre:
  • Year:
    2020
  • Rating:
    4 / 5
  • Favourites:
    Add to favourites
  • Your mark:
    • 80
    • 1
    • 2
    • 3
    • 4
    • 5

Deno - A Complete Guide to Programming With Deno: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "Deno - A Complete Guide to Programming With Deno" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

Jana Bergant: author's other books


Who wrote Deno - A Complete Guide to Programming With Deno? Find out the surname, the name of the author of the book and a list of all author's works by series.

Deno - A Complete Guide to Programming With Deno — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Deno - A Complete Guide to Programming With Deno" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
Deno - A Complete Guide to Programming With Deno Learn Deno by making projects - photo 1
Deno - A Complete Guide to Programming With Deno
Learn Deno by making projects
Jana Bergant

This book is for sale at http://leanpub.com/deno

This version was published on 2020-07-01

This is a Leanpub book Leanpub empowers authors and publishers with - photo 2

* * * * *

This is a Leanpub book. Leanpub empowers authors and publishers with the Lean Publishing process. Lean Publishing is the act of publishing an in-progress ebook using lightweight tools and many iterations to get reader feedback, pivot until you have the right book and build traction once you do.

* * * * *

2020 Jana Bergant
Deno Introduction
What is Deno

Deno is a new runtime for executing JavaScript and TypeScript outside of the web browser, similar to Node.js.

Deno is not a fork of Node its entirely a newly written implementation.

Deno and Node.js have another thing in common: Ryan Dahl.

In JSConfs presentation in 2018, Ryan Dahl explained his regrets while developing Node, like not sticking with promises, security issues, the build system (GYP), package.json, and node_modules.

In the same presentation, he announced his new work named Deno.

First Program in Deno

Lets run a Deno app for the first time.

In Deno, you can run a command from any URL. Lets open this sample code from the official Deno site.

When you open the URL in the browser, youll see this page:

Deno welcome sample code Deno website is showing the content of the file in a - photo 3Deno welcome sample code

Deno website is showing the content of the file in a more friendly page since we are opening it with a browser.

The raw file contains a simple console log.

1console.log('Welcome to Deno ')

You can run the code with a command:

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

Deno downloads the program compiles it and then runs it:

1$ deno run https://deno.land/std/examples/welcome.ts2Download https://deno.land/std/examples/welcome.ts3Warning Implicitly using master branch https://deno.land/std/examples/welcome.ts4Compile https://deno.land/std/examples/welcome.ts5Welcome to Deno

Running code from some random internet site would, in most cases, be a considerable security risk. Deno has a security sandbox that protects you, and we are running code from the official Deno site. You can breathe.

The second time you run the program, Deno does not need to download and compile it:

1$ deno run https://deno.land/std/examples/welcome.ts2Welcome to Deno

To redownload it and recompile it use the reload flag:

1$ deno run --reload https://deno.land/std/examples/welcome.ts2Download https://deno.land/std/examples/welcome.ts3Warning Implicitly using master branch https://deno.land/std/examples/welcome.ts4Compile https://deno.land/std/examples/welcome.ts5Welcome to Deno

## Deno Features

Deno is a simple, modern, and secure runtime for JavaScript and TypeScript. Deno works in the V8 Chromium Engine and is built in Rust programming language.

Main features of Deno are:

1. Deno is secure by default. It has no file, network, or environment access unless explicitly enabled.
2. It supports TypeScript out of the box. But can run both TypeScript (.ts) files, or JavaScript (.js) files.
3. It ships only a single executable file. Given a URL to a Deno program, it is runnable with nothing more than the ~15 megabytes zipped executable.
4. It explicitly takes on the role of both runtime and package manager. It uses a standard browser-compatible protocol for loading modules: URLs.
5. It has a set of reviewed standard modules that are guaranteed to work with Deno
6. As Node, Deno emphasizes event-driven architecture, providing a set of non-blocking core IO utilities, along with their blocking versions.
7. It provides built-in tooling like unit testing, dependency inspector, code formatting, and linting to improve the developer experience.
8. It includes browser compatible APIs. APIs are compatible with web standards so you can run in the browser. The code can run on the client as well as the server.

Package Management

There has been a radical rethink regarding the way package management works in Deno. Rather than relying on a central repository, it is decentralized. Anyone can host a package just like anyone can host any type of file on the web.

There are advantages and disadvantages to using a centralized repository like npm, and this aspect of Deno is sure to be the most controversial.

Its so radically simplified that it may shock you.

1import{assertEquals}from"https://deno.land/std/testing/asserts.ts";

Lets break down the changes.
- There is no more centralized package manager. You import ECMAScript modules directly from the web
- There is no more magical Node.js module resolution. Now, the syntax is explicit, which makes things much easier to reason about
- There is no more node_modules directory. Instead, the dependencies are downloaded and hidden away on your hard drive, out of sight.
- Remote code is fetched and cached on first execution, and never updated until you run the code 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.
- If you want to download dependencies alongside project code instead of using a global cache, use the $DENO_DIR env variable.

## Deno vs Node.js

Main Issues With Node.js
Any Program Can Write to the Filesystem and the Network

The permission to writing might be a security problem, especially when installing untrusted packages from npm.

The crossenv incident is an example. A package with a name very similar to the popular cross-env package was sending environment variables from its installation context out to npm.hacktask.net. The package naming was both deliberate and maliciousthe intent was to collect useful data from tricked users.

If crossenv had not had writing permissions, this would not have happened.

The Module System and the Npm

The main problem here is that the module system isnt compatible with browsers. That is the reason for storing dependencies in node_modules and having a package.json.

How Does Deno Fix These Issues?

With Deno, we can do the same things as with Node.js. We can build web servers and other utility scripts.

But Deno:

- By default supports Typescript, unlike Node.js - its a Javascript and Typescript runtime.
- Uses ES modules import system instead of having its own.
- Embraces modern Javascript features like Promises.
- Its secure by default.

Comparison to Node.js

Similarities:

  • Both run on the V8 Chromium Engine.
Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Deno - A Complete Guide to Programming With Deno»

Look at similar books to Deno - A Complete Guide to Programming With Deno. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «Deno - A Complete Guide to Programming With Deno»

Discussion, reviews of the book Deno - A Complete Guide to Programming With Deno and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.