Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Node.js for Beginners
Node.js for Beginners

Node.js for Beginners: A comprehensive guide to building efficient, full-featured web applications with Node.js

Arrow left icon
Profile Icon Ulises Gascón
Arrow right icon
zł39.99 zł145.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.8 (5 Ratings)
eBook May 2024 382 pages 1st Edition
eBook
zł39.99 zł145.99
Paperback
zł181.99
Subscription
Free Trial
Arrow left icon
Profile Icon Ulises Gascón
Arrow right icon
zł39.99 zł145.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.8 (5 Ratings)
eBook May 2024 382 pages 1st Edition
eBook
zł39.99 zł145.99
Paperback
zł181.99
Subscription
Free Trial
eBook
zł39.99 zł145.99
Paperback
zł181.99
Subscription
Free Trial

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Node.js for Beginners

Introduction to Node.js

Welcome to the first chapter of the book! Node.js is one of the most relevant technologies available and allows you to build any kind of project (web, desktop, CLI tools, microservices, IoT, and so on) within the same stack. The community around the project is very powerful and innovative.

In this chapter, we will explore the main features of Node.js and why it became so popular over time. Then, we will explore the Node.js architecture and how it works. Finally, we will explore the different versions of Node.js available to us.

In this chapter, we’re going to cover the following main topics:

  • What makes Node.js so special and why it is a revolutionary technology
  • The Node.js architecture and how it works
  • How to identify the right Node.js version for your projects

This knowledge will help you to decide when it is a good fit for your projects and will guide you around the complex ecosystem.

Technical requirements

The code files for the chapter can be found at https://github.com/PacktPublishing/NodeJS-for-Beginners.

Why is Node.js so popular?

The official definition of Node.js is very simple, but it doesn’t explain why Node.js has become so popular over time:

Node.js® is an open-source, cross-platform JavaScript runtime environment.

In Figure 1.1, we can see how the popularity of Node.js has been increasing over time, and even today, it is still growing fast.

Figure 1.1 – The interest in Node.js, generated using Google Trends

Figure 1.1 – The interest in Node.js, generated using Google Trends

Next, let’s explore the main reasons why Node.js is so popular.

Lightweight and fast

Node.js is a lightweight and fast runtime based on the V8 JavaScript engine, which is the same engine that powers Google Chrome and Microsoft Edge, among others. It is based on a single-thread architecture and event-driven model, which means that it doesn’t need to create a new thread for each request, as in other popular tools such as PHP. This is a huge advantage because the memory consumption is...

The Node.js single-thread architecture

When Node.js came out in 2009, it was a revolution in the web development world, as Ryan Dahl, the creator of Node.js, decided to use a very unusual approach at that time: a single-thread architecture.

In his presentation about Node.js at the JSConf (https://www.youtube.com/watch?v=EeYvFl7li9E), Ryan Dahl said he wanted to achieve two key things when building Node.js: server-side JavaScript and non-blocking I/O.

I/O needs to be done differently

The common approach for I/O operations in web applications is to create a new thread for each request. This is a very expensive operation because the memory consumption is very high and the performance is very low.

The idea behind this approach is to split the system resources and assign them to each thread. This is a very inefficient approach because, most of the time, the CPUs are idle, just waiting for the resources.

The other problem is that we are limited in the amount of memory that...

Node.js versions

Node.js follows semantic versioning (SemVer) (https://semver.org/) and it is important to understand how this versioning works in order to choose the best version for the project.

Semantic versioning (SemVer)

When considering semantic versioning, it helps to determine what changes to anticipate as a user, especially whether they might cause disruptions or not. This understanding assists our end users in preparing for potential updates.

Semantic versioning is one of the most popular ways to version software. In the following figure, we can differentiate the elements used to build the release version.

Figure 1.3 – Parts of a semantic version number (source: Devopedia 2020, https://devopedia.org/images/article/279/2766.1593275997.svg)

Figure 1.3 – Parts of a semantic version number (source: Devopedia 2020, https://devopedia.org/images/article/279/2766.1593275997.svg)

When a new version is released, the version number is incremented following the SemVer rules:

  • Major versions add incompatible API changes
  • Minor versions add functionality in a backward...

Summary

In this chapter, we explored what makes Node.js so special and how it differs from other backend systems. We also covered the history of Node.js and how it has evolved over the years.

Additionally, we covered the Node.js architecture and how it works under the hood. We learned about the event loop and how it allows Node.js to handle many concurrent requests efficiently.

In the next chapter, we will learn how to set up the development environment and start using Node.js.

Further reading

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Learn JavaScript, async programming, and event-driven architectures in Node.js
  • Discover best practices for secure deployment and testing of Node.js apps
  • Build a feature-rich web app from scratch using MongoDB, Express.js, and passport.js, including testing
  • Purchase of the print or Kindle book includes a free PDF eBook

Description

Node.js revolutionizes server-side JavaScript development and empowers developers to build efficient, scalable, and versatile applications across a range of use cases. This book is written by a Node.js core collaborator and releaser and is the only book for beginners on Node.js. It takes you on a progressive learning path that will give you the skills needed to leverage Node.js. You’ll learn Node.js fundamentals and refresh your knowledge of JavaScript before transitioning to the development of modern web applications using Node.js, Express.js, and MongoDB. You’ll get hands-on with complex topics such as asynchronous programming, npm libraries, event-driven patterns for HTTP servers, RESTful API, and JSON Web Tokens. The final chapters will walk you through the deployment process, offering insights into various strategies, including bare metal setups, virtual machines, and containerization with Docker. You’ll also be guided through the use of Process Manager 2 (PM2) for efficient process management. By the end of this Node.js book, you'll have the skills to craft, test, and deploy Node.js web applications confidently and use this powerful stack in your day-to-day projects.

Who is this book for?

This book is for developers eager to learn Node.js swiftly and utilize it for web app development. Front-end developers looking to delve into back-end development or become full-stack developers using Node.js will also benefit from this book’s comprehensive coverage of topics. Before you get started with this book, you’ll need to be familiar with the basics of coding (JavaScript programming or another language), Git and/or GitHub, and front-end development, as these topics aren’t covered in the book.

What you will learn

  • Build solid and secure Node.js applications from scratch
  • Discover how to consume and publish npm packages effectively
  • Master patterns for refactoring and evolving your applications over time
  • Gain a deep understanding of essential web development principles, including HTTP, RESTful API design, JWT, authentication, authorization, and error handling
  • Implement robust testing strategies to enhance the quality and reliability of your applications
  • Deploy your Node.js applications to production environments using Docker and PM2

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : May 10, 2024
Length: 382 pages
Edition : 1st
Language : English
ISBN-13 : 9781803238142
Languages :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : May 10, 2024
Length: 382 pages
Edition : 1st
Language : English
ISBN-13 : 9781803238142
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just zł20 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just zł20 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 565.97
Node.js for Beginners
zł181.99
Mastering Node.js Web Development
zł201.99
Modern Full-Stack React Projects
zł181.99
Total 565.97 Stars icon
Banner background image

Table of Contents

24 Chapters
Part 1: Node.js Overview and JavaScript Language Chevron down icon Chevron up icon
Chapter 1: Introduction to Node.js Chevron down icon Chevron up icon
Chapter 2: Setting Up the Development Environment Chevron down icon Chevron up icon
Chapter 3: JavaScript Fundamentals Chevron down icon Chevron up icon
Chapter 4: Asynchronous Programming Chevron down icon Chevron up icon
Part 2: Node.js Ecosystem and Architecture Chevron down icon Chevron up icon
Chapter 5: Node.js Core Libraries Chevron down icon Chevron up icon
Chapter 6: External Modules and npm Chevron down icon Chevron up icon
Chapter 7: Event-Driven Architecture Chevron down icon Chevron up icon
Chapter 8: Testing in Node.js Chevron down icon Chevron up icon
Part 3: Web Application Fundamentals Chevron down icon Chevron up icon
Chapter 9: Handling HTTP and REST APIs Chevron down icon Chevron up icon
Chapter 10: Building Web Applications with Express Chevron down icon Chevron up icon
Part 4: Building Solid Web Applications with Node.js Chevron down icon Chevron up icon
Chapter 11: Building a Web Application Project from Scratch Chevron down icon Chevron up icon
Chapter 12: Data Persistence with MongoDB Chevron down icon Chevron up icon
Chapter 13: User Authentication and Authorization with Passport.js Chevron down icon Chevron up icon
Chapter 14: Error Handling in Node.js Chevron down icon Chevron up icon
Chapter 15: Securing Web Applications Chevron down icon Chevron up icon
Part 5: Mastering Node.js Deployment and Portability Chevron down icon Chevron up icon
Chapter 16: Deploying Node.js Applications Chevron down icon Chevron up icon
Chapter 17: Dockerizing a Node.js Application Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.8
(5 Ratings)
5 star 80%
4 star 20%
3 star 0%
2 star 0%
1 star 0%
Leonardo Gomes May 31, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I have the e-book version and this book goes deep into all the concepts with many diagrams, code samples, and external references.The event loop explanation is easy to understand. Check the chapters list and you will see how complete this book is.Good reading to all!
Amazon Verified review Amazon
Robert Jun 13, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I really enjoyed reading this book!One thing I really liked was the approachable style to testing. Testing is one of those topics that can be hard to digest but is so important for the professional world and developing scalable safe applications.Another thing I really liked about the book is the section about deployment. He went through GitHub actions for a good CI pipeline. This is something that not many books talk about but I really appreciated.I definitely recommend this book for beginners. Not only does it go into practical ways of building node applications but also JavaScript itself and how it ties into building node apps.
Amazon Verified review Amazon
Salman Farsi Jun 01, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book covers the essentials of building efficient web applications using Node.js, including setting up the development environment, understanding JavaScript fundamentals, and mastering asynchronous programming. The book also delves into the Node.js ecosystem, exploring core libraries, external modules, event-driven architecture, and testing in Node.js. Later sections focus on web application fundamentals, handling HTTP and REST APIs, data persistence with MongoDB, and securing web applications. It’s a valuable resource for anyone looking to enhance their skills in Node.js and web development.
Amazon Verified review Amazon
Maurizio Lupo May 18, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
As a seasoned Node.js developer (started in 2010), all my reference books are fairly outdated. I was searching a book for my son : he is 17 ans he is studying Computer Science A level and he will soon start a work experience.This book touches the right topics, the order also makes a lot of sense.The explanations are super clear and there are a ton of references to relevant material.It is just the perfect book for starting with Node.js
Amazon Verified review Amazon
Cara May 22, 2024
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
This book is a great resource for beginners. It makes learning a potentially intimidating subject much easier. Though it's meant to be a refresher, I'm not sure how necessary the JavaScript Fundamentals chapter is. Aside from this, the book covers pretty much everything you need to know to get started with NodeJS. The projects included really reinforce your understanding. I would definitely recommend this book to anyone wanting to get started with NodeJS.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.