Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Mastering Node.js Web Development
  • Table Of Contents Toc
  • Feedback & Rating feedback
Mastering Node.js Web Development

Mastering Node.js Web Development

By : Adam Freeman
4.9 (7)
close
close
Mastering Node.js Web Development

Mastering Node.js Web Development

4.9 (7)
By: Adam Freeman

Overview of this book

Dive into the world of Node.js with this comprehensive guide, taking you from foundational concepts to practical web development mastery. Written by an industry veteran with over 50 programming books under his belt, this book will help both beginners and seasoned developers. Gain a deep understanding of the most important server-side features in web development with Node.js. The first part of the book will get you up to speed with basic features of Node.js and TypeScript. In the second part, you’ll elevate your skills by creating simplified implementations of key server-side features to understand how they work and how they are presented to clients. Armed with the understanding gained from implementing each feature, you will be able to replace custom code with production-ready open-source packages. The third part will help you understand how server-side features are combined for practical web development. Using Adam Freeman’s signature SportsStore application, you will learn how to develop client and server-side components, culminating in a thorough application deployment preparation. By the end of this Node.js book, you will be able to build and deploy server applications to support HTTP clients, including JavaScript applications created with frameworks such as Angular and React.
Table of Contents (26 chapters)
close
close
Lock Free Chapter
1
Putting Node.js in Context
10
Node.js in Detail
18
SportsStore
25
Other Books You May Enjoy
26
Index

Using the Node.js API

Node.js replaces the API provided by the browser with one that supports common server-side tasks, such as processing HTTP requests and reading files. Behind the scenes, Node.js uses native threads, known as the worker pool, to perform operations asynchronously.

To demonstrate, Listing 4.10 uses the Node.js API to read the contents of a file.

Listing 4.10: Using the Node.js API in the handler.ts File in the src Folder

import { IncomingMessage, ServerResponse } from "http";
import { readFile } from "fs";
export const handler = (req: IncomingMessage, res: ServerResponse) => {
    readFile("data.json", (err: Error | null, data: Buffer) => {
        if (err == null) {
            res.end(data, () => console.log("File sent"));
        } else {
            console.log(`Error: ${err.message}`);
            res.statusCode = 500;
            res.end();
        }
    });
};

As its name suggests, the readFile...

Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Mastering Node.js Web Development
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon