Build Your Own Web Server From Scratch In Node.JS
Build Your Own Web Server From Scratch In Node.JS
Learn network programming, HTTP, and WebSocket by coding a Web Server
About the Book
Learn by doing: code a Web server in Node.js
Most people use HTTP daily, but few understand its inner workings. This "Build Your Own X" book dives deep, teaching basics from scratch for a clearer understanding of the tools and tech we rely on.
- Network programming.
- Protocols & communication.
- HTTP in detail.
- WebSocket & concurrency.
The project uses Node.js and TypeScript without any dependencies, but many concepts are language-agnostic, so it’s valuable for learners of any language.
Beyond coding exercises
At the end of each chapter, there are discussions about:
- What’s missing from the code? The gap between toys and the real thing, such as optimizations and applications.
- Important concepts beyond coding, such as event loops and backpressure. These are what you are likely to overlook.
- Design choices. Why stuff has to work that way? You can learn from both the good ones and the bad ones.
- Alternative routes. Where you can deviate from this book.
Build your own X
Why take on a build-your-own-X challenge? A few scenarios to consider:
- Students: Solidify learning, build portfolio, stand out in future careers.
- Developers: Master fundamentals beyond frameworks and tools.
- Hobbyists: Explore interests with flexible, extensible projects.
This is part of the “Build Your Own X” book series, which includes books on building your own Redis, database, and compiler.
Packages
The Book
PDF
EPUB
English
Book + Source code
Includes TypeScript and JS code for each chaper.
Includes:
Source code per chapter
TypeScript and JS code for each chapter.
PDF
EPUB
English
Table of Contents
Designed to guide you through your own web server implementation, the book follows a _step-by-step_ approach, and each chapter builds on the previous one.
An outline of each step:
1. TCP echo server. - Socket primitives in Node.JS. - Event-based programming. - `async/await` and promises. 2. A simple messaging protocol. - Implementing a network protocol in TCP. - Working with byte streams and managing buffers. 3. Basic HTTP server. - HTTP semantics and syntax. - Generating dynamic content. - Async generators. 4. Core applications. - Serving static files. - File IO in Node.JS. - Programming tip: avoiding resource leaks. - Range requests. - Caching control. - Compression. - The stream and pipe abstraction. 5. WebSocket. - Message-based designs. - Concurrent programming. - Blocking queues.
The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.
You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!
So, there's no reason not to click the Add to Cart button, is there?
See full terms...
Earn $8 on a $10 Purchase, and $16 on a $20 Purchase
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earnedover $14 millionwriting, publishing and selling on Leanpub.
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them