Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Node.js for Beginners

You're reading from  Node.js for Beginners

Product type Book
Published in May 2024
Publisher Packt
ISBN-13 9781803245171
Pages 382 pages
Edition 1st Edition
Languages
Author (1):
Ulises Gascón Ulises Gascón
Profile icon Ulises Gascón
Toc

Table of Contents (25) Chapters close

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

What this book covers

Chapter 1, Introduction to Node.js, provides an introduction to Node.js as a runtime and also explains the core architecture behind the single thread. It will also cover the versioning of Node.js and its release schedule.

Chapter 2, Setting Up the Development Environment, covers how to install Node.js on the most popular operating systems and you will learn how to manage multiple versions of Node.js on the same machine. It will also cover how to use the Node.js REPL and the web browser console to debug Node.js and JavaScript applications.

Chapter 3, JavaScript Fundamentals, helps you to refresh your knowledge of JavaScript basics such as operators and loops. You will also learn how to use specific JavaScript features such as closures, hoisiting, and prototype inherit.

Chapter 4, Asynchronous Programming, teaches you how to implement the callback pattern, handle promises, and use Async/Await syntax, and you will also learn how to properly combine all the patterns, including error handling

Chapter 5, Node.js Core Libraries, covers the core libraries’ structure including the stability index and command-line options for the Node.js binary. Also, you will learn how to modularize any code using ESM and CJS and how to combine them.

Chapter 6, External Modules and npm, covers how to use the NPM CLI to manage dependencies, and use npx to use CLI tools without adding them to your project. You will learn how to build isomorphic code that can be executed in Node.js and in the browser and you will publish your first package to npm. We will also discuss npm alternatives such as Yarn or PnPM.

Chapter 7, Event-Driven Architecture, explores how the event-driven architecture is included in many core libraries such as fs and http. You will create applications that react to changes in files or receive HTTP requests, and will learn how to include an event API in your own modules as an API layer.

Chapter 8, Testing in Node.js, explores how testing is done in Node.js and all the possible approaches. We will use the Core testing library and Jest to build unit tests, and will use the coverage report to understand where to improve our testing strategy. Additionally, we will explore how the Test-Driven Development (TDD) approach in practical terms.

Chapter 9, Handling HTTP and REST APIs, teaches different strategies to build a web application (such as SPAs and server-side rendering) and how HTTP is structured in a way that allows us to build modern and solid APIs (with HTTP headers, status codes, payloads, and versions). We also learn how to use te URLs to build powerful interfaces while transferring data using JSON format.

Chapter 10, Building Web Applications with Express, shows how to use Express in depth (request, response, redirections, status codes, and header management) and also covers how to use middleware libraries and built your own ones.

Chapter 11, Building a Web Application Project from Scratch, We will begin our work on our project and will build a REST API covered by tests using the supertest library. This project will evolve, so we will iterate over the project adding new features and new tests, so you can experience the full development cycle of a real world application using Node.js.

Chapter 12, Data Persistence with MongoDB, demonstrates how to set up MongoDB and how to handle secrets in Node.js (.env files and environmental variables). We will explore the ORM universe with Mongoose and will evolve the project to use MongoDB as the database solution, including tests and coverage reports.

Chapter 13, User Authentication and Authorization with Passport.js, teaches the differences between authentication and authorization, as well exploring how modern web security is built based on cryptography by covering in detail how JSON Web Tokens (JWT) work. We will also implement this with our middleware in the project, and will learn how Passport.js can be used to handle social login strategies.

Chapter 14, Error Handling in Node.js, covers how to make our applications more resilient by properly defining and handling errors of any kind. We also see how to gracefully shut down the application and avoid generating zombie processes.

Chapter 15, Securing Web Applications, explores social the impact and attack vectors for your projects. We will explore how the OWASP Top 10, Common Weakness Enumeration (CWE), and Common Vulnerabilities and Exposures (CVE) work together to evaluate risks and mitigate them in our applications. We also cover the offical Node.js security best practices and the thread model. You will have the opportunity to put all of this into practice with the project that we build together, along with exploring other ways to grow in this area by exploring the ethical hacker universe.

Chapter 16, Deploying Node.js Applications, sees us deploy our application to the public internet, emphasizing clear requirements and solution choices. We will use GitHub Actions for CI, and DigitalOcean, PM2 and MongoDB Atlas for the database

Chapter 17, Dockerizing a Node.js Application, we deploy our application to the public internet using Docker and DigitalOcean. Also we will use GitHub Actions for Continous Integration (CI). We will explore domain setup, Cloudflare SSL, and the twelve-factor app principles.

The author acknowledges the use of cutting-edge AI, such as ChatGPT, with the sole aim of enhancing the language and clarity within the book, thereby ensuring a smooth reading experience for readers. It's important to note that the content itself has been crafted by the author and edited by a professional publishing team.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime