Modern Web Development with Deno: Develop Modern JavaScript and TypeScript Code with Svelte, React, and GraphQL (English Edition)
By Mayur Borse
()
About this ebook
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.
Related to Modern Web Development with Deno
Related ebooks
React Components Rating: 0 out of 5 stars0 ratingsVue.js 2 Cookbook Rating: 0 out of 5 stars0 ratingsAdvanced Web Development with React: SSR and PWA with Next.js using React with advanced concepts Rating: 0 out of 5 stars0 ratingsLearn NodeJS in 1 Day: Complete Node JS Guide with Examples Rating: 3 out of 5 stars3/5Full Stack Development Explained: From Frontend to Backend Rating: 0 out of 5 stars0 ratingsReact.js Design Patterns: Learn how to build scalable React apps with ease (English Edition) Rating: 0 out of 5 stars0 ratingsMastering MEAN Stack: Build full stack applications using MongoDB, Express.js, Angular, and Node.js (English Edition) Rating: 0 out of 5 stars0 ratingsGetting Started with React Rating: 0 out of 5 stars0 ratingsSvelte: A Beginner's Guide Rating: 0 out of 5 stars0 ratingsExpress Web Application Development Rating: 3 out of 5 stars3/5Advanced React Patterns Rating: 0 out of 5 stars0 ratingsBuilding Scalable Web Apps with Node.js and Express Rating: 0 out of 5 stars0 ratingsLearning Single-page Web Application Development Rating: 0 out of 5 stars0 ratingsNode.js By Example Rating: 2 out of 5 stars2/5React JS and Express Framework: A Comprehensive Guide Rating: 0 out of 5 stars0 ratingsMEAN Web Development Rating: 5 out of 5 stars5/5Responsive Web Design by Example : Beginner's Guide - Second Edition Rating: 0 out of 5 stars0 ratingsVue.js: Tools & Skills Rating: 0 out of 5 stars0 ratingsModern JavaScript Applications Rating: 0 out of 5 stars0 ratingsBuilding Scalable Apps with Redis and Node.js Rating: 0 out of 5 stars0 ratingsBuilding Single-page Web Apps with Meteor Rating: 5 out of 5 stars5/5Modern Web Development: Kickstarting with Svelte Rating: 0 out of 5 stars0 ratingsHands-on React Native Rating: 1 out of 5 stars1/5JavaScript Programming: Pushing the Limits Rating: 0 out of 5 stars0 ratingsLearn Angular: Build a Todo App Rating: 0 out of 5 stars0 ratingsRESTful Web API Design with Node.js - Second Edition Rating: 1 out of 5 stars1/5Angular 9 UI/UX Mastery Rating: 0 out of 5 stars0 ratingsMastering Go: Navigating the World of Concurrent Programming Rating: 0 out of 5 stars0 ratings
Programming For You
Excel : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Excel Programming: 1 Rating: 5 out of 5 stars5/5Python Programming : How to Code Python Fast In Just 24 Hours With 7 Simple Steps Rating: 4 out of 5 stars4/5Coding All-in-One For Dummies Rating: 4 out of 5 stars4/5Teach Yourself C++ Rating: 4 out of 5 stars4/5Beginning Programming with C++ For Dummies Rating: 4 out of 5 stars4/5Python: Learn Python in 24 Hours Rating: 4 out of 5 stars4/5Python: For Beginners A Crash Course Guide To Learn Python in 1 Week Rating: 4 out of 5 stars4/5Learn to Code. Get a Job. The Ultimate Guide to Learning and Getting Hired as a Developer. Rating: 5 out of 5 stars5/5SQL QuickStart Guide: The Simplified Beginner's Guide to Managing, Analyzing, and Manipulating Data With SQL Rating: 4 out of 5 stars4/5Microsoft Azure For Dummies Rating: 0 out of 5 stars0 ratingsSQL All-in-One For Dummies Rating: 3 out of 5 stars3/5Excel 101: A Beginner's & Intermediate's Guide for Mastering the Quintessence of Microsoft Excel (2010-2019 & 365) in no time! Rating: 0 out of 5 stars0 ratingsPython Data Structures and Algorithms Rating: 5 out of 5 stars5/5Learn PowerShell in a Month of Lunches, Fourth Edition: Covers Windows, Linux, and macOS Rating: 5 out of 5 stars5/5HTML in 30 Pages Rating: 5 out of 5 stars5/5Coding with JavaScript For Dummies Rating: 0 out of 5 stars0 ratingsPython for Data Science For Dummies Rating: 0 out of 5 stars0 ratingsProblem Solving in C and Python: Programming Exercises and Solutions, Part 1 Rating: 5 out of 5 stars5/5Windows 11 For Dummies Rating: 0 out of 5 stars0 ratingsJavaScript All-in-One For Dummies Rating: 5 out of 5 stars5/5Python Crash Course, 3rd Edition: A Hands-On, Project-Based Introduction to Programming Rating: 4 out of 5 stars4/5
Reviews for Modern Web Development with Deno
0 ratings0 reviews
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