I have finished a few days ago a beginner’s book about Node.
Name of the book: The Node Beginner Book , A comprehensive Node.js tutorial
Author: Manuel Kiessling
I liked it and the way it’s written so I would like to share it with you.
I came across this book while looking for Node tutorials on the web.
So first, here’s the site of the book: http://www.nodebeginner.org/
It consists part of the first chapter of the book. As a tutorial and explanation.
I started going over the tutorial and when I was done with this part I went on and bought the book.
Another cool thing is that you can buy it from Leanpub as part of a bundle that has Hands-On Node.js as well. (I haven’t read this one yet).
The book walks through a very basic Node server construction.
Instead of just Hello World, we actually build a small server that can upload and show an image.
It covers the basics, which I feel is enough to understand the concepts of Node and to give a really good kickoff for someone who is interested in Node.
We start by installing Node and understand a little bit about JS.
At the beginning there’s a clear explanation of the use case of what we’re going to develop.
And, the importance of the architecture and how it should look like.
Then, step by step, we build the server.js , the index.js, router.js and request handlers.
I think that this is really important, as it emphasize a good approach of architecture design.
The author emphasize how important is to separate concerns and create an organized code.
Another really good aspect is the explanation of functional programming and how it helps in Node and HTTP server. Now, you’re not going to be a functional programmer after reading this book, but you will defiantly understand the concepts and get the idea.
For me, it’s a really good thing. As a Java developer, I don’t use the functional paradigm, and it’s an important tool these days.
(Yes, I know that there are many other functional languages. But that’s my point. By reading this book, I had a good opportunity to play with some functional paradigm.)
The book gradually evolves the server creation.
After we build the server.js, we start enhancing it.
We build index.js file that holds mapping of routing.
We build router.js that routes to the request handler.
And requestHandlers.js to work with the different requests.
Each part in the system evolves while reading the book.
For example, at the beginning a function does not accept any parameter. Then it accepts some and later the parameters change.
Every change is explained in the context and how it helps with aspects such as good architecture and design, asynchronous and other concepts.
One of the examples, which I liked was why passing a callback function is important. The book shows nicely what happens if you run a slow operation (find in a file system), which is synchronous (not a callback function). Basically your whole server gets stuck.
Towards the end, after we built simple yet flexible server, we learn some technical Node stuff. How to use external libraries with the package manager NPM.
And by using it, we learn how to show an image, upload a file and rename it.
At the end of the book we get a working Node server for upload and image and show it.
It’s fun !
I highly recommend it to anyone who wants to understand what Node is all about, but more than just the syntax.
The author has another book, which I bought but haven’t read yet: The Node Craftsman Book.
Happy Reading !