Discover millions of audiobooks, ebooks, and so much more with a free trial

From $11.99/month after trial. Cancel anytime.

Modern Web Development with Deno: Develop Modern JavaScript and TypeScript Code with Svelte, React, and GraphQL (English Edition)
Modern Web Development with Deno: Develop Modern JavaScript and TypeScript Code with Svelte, React, and GraphQL (English Edition)
Modern Web Development with Deno: Develop Modern JavaScript and TypeScript Code with Svelte, React, and GraphQL (English Edition)
Ebook323 pages1 hour

Modern Web Development with Deno: Develop Modern JavaScript and TypeScript Code with Svelte, React, and GraphQL (English Edition)

Rating: 0 out of 5 stars

()

Read preview

About this ebook

Deno is a web platform that offers capabilities for JavaScript and TypeScript and supports modern web standards. It is a straightforward, up-to-date, secure runtime environment for web developers.

This book will teach all you need to know about Deno's primitives, its ideas, and how you can use them to build applications that work in the real world. The book's first part is devoted to familiarizing you with Deno's runtime and comprehensive ecosystem. This book will help you to get familiar with TypeScript and experiment with Deno. The book will also help you to learn about GraphQL and Oak and build basic scripts. It will help you to design basic web applications such as a phonebook application and a to-do list application, both of which will have their user interfaces (UI) and APIs developed.

This book will help you to get a good level of confidence with Deno over NodeJS so that you can start using Deno to build, maintain, and deploy web apps that are reliable and secure.
LanguageEnglish
PublisherBPB Online LLP
Release dateOct 7, 2022
ISBN9789355510976
Modern Web Development with Deno: Develop Modern JavaScript and TypeScript Code with Svelte, React, and GraphQL (English Edition)

Related to Modern Web Development with Deno

Related ebooks

Programming For You

View More

Reviews for Modern Web Development with Deno

Rating: 0 out of 5 stars
0 ratings

0 ratings0 reviews

What did you think?

Tap to rate

Review must be at least 10 words

    Book preview

    Modern Web Development with Deno - Mayur Borse

    CHAPTER 1

    The Deno Land

    Introduction

    After a decade of success of Node runtime, its creator Ryan Dahl has come up with another exciting technology called Deno, which is also a runtime like Node but is more secure and provides many improvements and modern features in comparison to Node. Dahl stormed the development world by announcing Deno during a JSCONF EU talk in 2018 named 10 things I Regret about Node.js (https://www.youtube.com/watch?v=M3BM9TB-8yA). Since then, Deno has been a topic of excitement in the software industry.

    Structure

    In this chapter, we will cover the following topics:

    Introducing Deno

    The Node revolution

    Comparison of Deno and Node

    Deno features

    Deno foundation stack

    What is a JavaScript engine?

    What is a JavaScript runtime?

    Objectives

    After studying this chapter, you will be familiar with the main features of Deno and its internal architecture. You will also be able to understand the reasons for the creation of Deno, the role of Node in the creation of Deno, the similarities and differences between Deno and Node, and the stack used for creating Deno, that is, Chrome V8 Engine by Google, Rust by Mozilla, and Tokio.

    You will also be familiar with how the JavaScript engine works and how the JavaScript runtime works.

    Introducing Deno

    Deno is a secure and modern JavaScript runtime that uses the V8 engine for JavaScript code conversion, Tokio (written in Rust) for async event handling and the API backend written in Rust. It provides features as follows:

    Integrated security. Access to the network, file, and environment is provided only through flags.

    Built-in tools such as formatter, test-runner, debugger, linter, and so on.

    Typescript support out of the box.

    Top-level await (without async).

    ES Modules import (default).

    No package manager is required as module imports are done using URLs.

    Deno is the creation of Ryan Dahl. Interestingly, Dahl is also the creator of Node, which is also a runtime. In fact, Deno was created to overcome the limitations of Node and provide modern features out of the box, which is not part of Node runtime. Hence, the journey of Deno begins with Node, which changed the way JavaScript was perceived and used in the industry. It is a fact that JavaScript has become a widely used and revered language after the entry of Node. Many developers are using only JavaScript for their entire stack, thanks to Node. Therefore, to understand "The Deno Evolution, one must begin with The Node Revolution".

    The Node Revolution

    A decade ago, JavaScript was mocked as a funny and peculiar language useful mostly for front-end Web development. The scope of JavaScript was very limited compared to mainstream languages like C++ or Java, as it was mainly useful for browser-based applications only.

    In 2009, Ryan Dahl introduced Node.js to the world. Node is a JavaScript runtime written in C++ which uses V8 Engine by Google (launched in 2008) and libuv event loop to perform asynchronous operations in the background. Since its release, Node.js has revolutionized JavaScript usability and is being used by several tech giants such as PayPal, LinkedIn, Netflix, and Uber to name a few. Let us see the features that led to the rise of Node.

    JavaScript everywhere

    Node has been the reason that made JavaScript available outside the browser. Nowadays, JavaScript is used for development across many domains. Electron.js is used for cross-platform desktop apps, React.js for Web development, and React Native for mobile development. Many companies and developers use JavaScript alone for their entire stack as the code logic can be moved from client to server because both are using the same language.

    Asynchronous and event-driven architecture

    Node is single-threaded, meaning it contains only one call stack that executes only one program at a time. It has event-driven architecture. This means executions in Node are done according to some event occurrence. Node uses an event loop libuv to handle executions asynchronously, i.e., in a non-blocking way.

    Open-source and cross-platform

    Node is open source which is one of the major factors for its popularity and acceptance amongst the developers.

    Cross-platform support is also an amazing feature node offers to developers. It works on OSX, Linux and Windows very well. Using this benefit, a developer can write node code on OSX and can use Linux to deploy.

    Very performant

    Node uses V8 JavaScript Engine under the hood. The V8 engine is very fast, and this makes the Node a very high-performing runtime. Performance is one of the major feature node offers.

    A node package manager (npm) for handling dependencies

    Node package manager npm is used to install packages and manage package dependencies. It is also a centralized registry where users can publish their node packages.

    Event loop

    Node uses libuv event loop for performing async i/o operations. The event loop uses workers and a thread pool for performing operations in the background. It also checks if the call stack is empty and the main programme has been executed so it can push the code from the callback queue to the empty call stack. The JavaScript runtime process is available in visualization here (http://latentflip.com/loupe/). We will check the JavaScript runtime architecture in detail later in this chapter.

    Along with such great features, Node has several shortcomings, which led its creator Ryan Dahl to start a new project (Deno). In the next section, we will compare Deno with Node and see how Deno overcomes Node’s shortcomings.

    Deno comparison with Node

    Deno was created to address the shortcomings of Node. So, it would be evident that both of them will have many similarities and differences. Let us check each of these.

    Deno features

    Deno has excellent support for modern features and includes many features not available in Node out of the box (TypeScript support). Let us have a look at some of its main features.

    External dependencies are loaded using URLs

    Code execution in Sandbox

    Runtime has no access to network file systems and

    Enjoying the preview?
    Page 1 of 1