Book Image

Node.js Blueprints

By : Krasimir Stefanov Tsonev
Book Image

Node.js Blueprints

By: Krasimir Stefanov Tsonev

Overview of this book

Table of Contents (19 chapters)
Node.js Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

As you probably know, the big things in our sphere are those that are moved by the community. Node.js is a technology that has become really popular. Its ecosystem is well-designed and brings with it the flexibility we need. With the rise of mobile development, JavaScript occupies a big part of the technology stack nowadays. The ability to use JavaScript on the server side is really interesting. It's good to know how Node.js works and where and when to use it, but it is more important to see some examples. This book will show you how this wonderful technology handles real use cases.

What this book covers

Chapter 1, Common Programming Paradigms, introduces us to the fact that Node.js is a JavaScript-driven technology, and we can apply common design patterns known in JavaScript in Node.js as well.

Chapter 2, Developing a Basic Site with Node.js and Express, discusses how ExpressJS is one of the top frameworks on the market. ExpressJS was included because of its fundamental importance in the Node.js world. At the end of the chapter, you will be able to create applications using the built-in Express modules and also add your own modules.

Chapter 3, Writing a Blog Application with Node.js and AngularJS, teaches you how to use frontend frameworks such as AngularJS with Node.js. The chapter's example is actually a dynamic application that works with real databases.

Chapter 4, Developing a Chat with Socket.IO, explains that nowadays, every big web app uses real-time data. It's important to show instant results to the users. This chapter covers the creation of a simple real-time chat. The same concept can be used to create an automatically updatable HTML component.

Chapter 5, Creating a To-do Application with Backbone.js, illustrates that Backbone.js was one of the first frameworks that introduced data binding at the frontend of applications. This chapter will show you how the library works. The to-do app is a simple example, but perfectly illustrates how powerful the framework is.

Chapter 6, Using Node.js as a Command-line Tool, covers the creation of a simple CLI program. There are a bunch of command-line tools written in Node.js, and the ability to create your own tool is quite satisfying. This part of the book will present a simple application which grabs all the images in a directory and uploads them to Flickr.

Chapter 7, Showing a Social Feed with Ember.js, describes an Ember.js example that will read a Twitter feed and display the latest posts. That's actually a common task of every developer because a lot of applications need to visualize social activity.

Chapter 8, Developing Web App Workflow with Grunt and Gulp, shows that there are a bunch of things to do before you can deliver the application to the users, such as concatenation, minification, templating, and so on. Grunt is the de facto standard for such tasks. The described module optimizes and speeds up your workflow. The chapter presents a simple application setup, including managing JavaScript, CSS, HTML, and cache manifests.

Chapter 9, Automate Your Testing with Node.js, signifies that tests are really important for every application nowadays. Node.js has some really great modules for this. If you are a fan of test-driven development, this chapter is for you.

Chapter 10, Writing Flexible and Modular CSS, introduces the fact that two of the most popular CSS preprocessors are written in Node.js. This chapter is like a little presentation on them and, of course, describes styling a simple web page.

Chapter 11, Writing a REST API, states that Node.js is a fast-working technology, and it is the perfect candidate for building a REST API. You will learn how to create a simple API to store and retrieve data for books, that is, an online library.

Chapter 12, Developing Desktop Apps with Node.js, shows that Node.js is not just a web technology—you can also create desktop apps with it. It's really interesting to know that you can use HTML, CSS, and JavaScript to create desktop programs. Creating a simple file browser may not be such a challenging task, but it will give you enough knowledge to build your own applications.

What you need for this book

You need Node.js installed, a browser, and your favorite code editor. That's all you will use. There are a lot of additional modules to be used, but Node.js comes with a wonderful package manager which handles the installation process.

Who this book is for

The book is for intermediate developers. It teaches you how to use popular Node.js libraries and frameworks. So, good JavaScript knowledge is required.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "The http module, which we initialize on the first line, is needed for running the web server."

A block of code is set as follows:

var http = require('http');
var getTime = function() {
var d = new Date();
return d.getHours() + ':' + d.getMinutes() + ':' + 
d.getSeconds() + ':' + d.getMilliseconds();
}

Any command-line input or output is written as follows:

express --css less myapp

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "Click on the blue button with the text OK, I'LL AUTHORIZE IT."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Downloading the color images of this book

We also provide you a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from: https://www.packtpub.com/sites/default/files/downloads/7338OS_ColoredImages.pdf

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.