Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Learning Node.js Development
Learning Node.js Development

Learning Node.js Development: Learn the fundamentals of Node.js, and deploy and test Node.js applications on the web

Arrow left icon
Profile Icon Andrew Mead
Arrow right icon
₱1256.99 ₱1796.99
Full star icon Full star icon Full star icon Half star icon Empty star icon 3.6 (16 Ratings)
eBook Jan 2018 658 pages 1st Edition
eBook
₱1256.99 ₱1796.99
Paperback
₱2245.99
Subscription
Free Trial
Arrow left icon
Profile Icon Andrew Mead
Arrow right icon
₱1256.99 ₱1796.99
Full star icon Full star icon Full star icon Half star icon Empty star icon 3.6 (16 Ratings)
eBook Jan 2018 658 pages 1st Edition
eBook
₱1256.99 ₱1796.99
Paperback
₱2245.99
Subscription
Free Trial
eBook
₱1256.99 ₱1796.99
Paperback
₱2245.99
Subscription
Free Trial

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Table of content icon View table of contents Preview book icon Preview Book

Learning Node.js Development

Node Fundamentals – Part 1

In this chapter, you'll learn a ton about building Node applications, and you'll actually build your first Node application. This is where all the really fun stuff is going to start.

We'll kick things off by learning about all of the modules that come built in to Node. These are objects and functions that let you do stuff with JavaScript you've never been able to do before. We'll learn how to do things, such as reading and writing from the filesystem, which we'll use in the Node's application to persist our data.

We'll also be looking at third-party npm modules; this is a big part of the reason that Node became so popular. The npm modules give you a great collection of third-party libraries you can use, and they also have really common problems. So you don't have to rewrite that boilerplate code over...

Module basics

In this section, you will finally learn some Node.js code, and we'll kick things off by talking about modules inside Node. Modules are units of functionality, so imagine I create a few functions that do something similar, such as a few functions that help with math problems, for example, add, subtract, and divide. I could bundle those up as a module, call it Andrew-math, and other people could take advantage of it.

Now, we'll not be looking at how to make our own module; in fact, we will be looking at how we can use modules, and that will be done using a function in Node, called require(). The require() function will let us do three things:

  • First, it'll let us load in modules that come bundled with Node.js. These include the HTTP module, which lets us make a web server, and the fs module, which lets us access the filesystem for our machine.
We will...

Require own files

In this section, you will learn how to use require() to load in other files that you created inside your project. This will let you move functions outside app.js into more specific files; this will make your application easier to scale, test, and update. To get started, the first thing we'll do is to make a new file.

Making a new file to load other files

In the context of our notes app, the new file will store various functions for writing and reading notes. As of now, you don't need to worry about that functionality, as we'll get into the detail later in the section, but we will create the file where it will eventually live. This file will be notes.js, and we'll save it inside the root...

Third-party modules

You now know two out of the three ways to use require(), and in this section, we'll explore the last way, which is to require a package you've installed from npm. As I mentioned in the first chapter, npm is a big part of what makes Node so fantastic. There is a huge community of developers that have created thousands of packages that already solve some of the most common problems in Node applications. We will be taking advantage of quite a few packages throughout the book.

Creating projects using npm modules

Now, in the npm packages, there's nothing magical, it's regular Node code that aims to solve a specific problem. The reason you'd want to use it is so you don't have to...

Global modules

One of the major complaints I get is the fact that students have to restart the app from the Terminal every time they want to see the changes they just made inside their text editor. So, in this section, we'll take a look at how we can automatically restart our app as we make changes to the file. That means if I change from Gary to Mike and save it, it will automatically restart over in the Terminal.

Installing the nodemon module

Now, to automatically restart our app as we make changes to a file, we have to install a command-line utility, and we'll do this using npm. To get started, we'll go to Google Chrome (or the browser you are using) and head over to https://www.npmjs.com, as we did previously...

Getting input

If a user wants to add a note, we need to know the note's title as well as the body of the note. If they want to fetch a note, we need to know the title of the note they want to fetch, and all this information needs to come into our app. And note apps, don't really do anything cool until they get this dynamic user input. This is what makes your scripts useful and awesome.

Now, throughout the book, we'll be creating note apps that get input from the user in a lot of different ways. We'll be using socket I/O to get real-time info from a web app, we'll be creating our own API so other websites and servers can make Ajax requests to our app, but in this section, we'll start things off with a very basic example of how to get user input.

We'll be getting input from the user inside the command line. That means when you run the app in the...

Summary

In this chapter, we learned how to use require to load in modules that come with Node.js. We created our files for our notes application and required them inside app.js. We explored how to use built-in modules and we explored how to use modules we defined. We found out how to require other files that we created, and how to export things such as properties and functions from those files.

We explored npm a little bit, how we can use npm init to generate a package.json file, and how we can install and use third-party modules. Next, we explored the nodemon module, using it to automatically restart our app as we make changes to a file. Last, we learned how to get input from the user, which is needed to create the notes application. We learned that we can use command-line arguments to pass data into our app.

In the next chapter, we'll explore some more interesting Node...

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • • Entirely project-based and practical
  • • Explains the "Why" of Node.js features, not just the "how", providing you with a deep understanding and enabling you to easily apply concepts in your own applications
  • • Covers the full range of technologies around Node.js – NPM, version control with Git, and much more

Description

Learning Node.js Development is a practical, project-based book that provides you with all you need to get started as a Node.js developer. Node is a ubiquitous technology on the modern web, and an essential part of any web developers' toolkit. If you are looking to create real-world Node applications, or you want to switch careers or launch a side project to generate some extra income, then you're in the right place. This book has been written around a single goal—turning you into a professional Node developer capable of developing, testing, and deploying real-world production applications. Learning Node.js Development is built from the ground up around the latest version of Node.js (version 9.x.x). You'll be learning all the cutting-edge features available only in the latest software versions. This book cuts through the mass of information available around Node and delivers the essential skills that you need to become a Node developer. It takes you through creating complete apps and understanding how to build, deploy, and test your own Node apps. It maps out everything in a comprehensive, easy-to-follow package designed to get you up and running quickly.

Who is this book for?

This book targets anyone looking to launch their own Node applications, switch careers, or freelance as a Node developer. You should have a basic understanding of JavaScript in order to follow this course.

What you will learn

  • • Learn the fundamentals of Node
  • • Build apps that respond to user input
  • • Master working with servers
  • • Learn how to test and debug applications
  • • Deploy and update your apps in the real world
  • • Create responsive asynchronous web applications

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jan 31, 2018
Length: 658 pages
Edition : 1st
Language : English
ISBN-13 : 9781788396349
Languages :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want

Product Details

Publication date : Jan 31, 2018
Length: 658 pages
Edition : 1st
Language : English
ISBN-13 : 9781788396349
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just ₱260 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just ₱260 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 7,859.97
Node Cookbook
₱2806.99
Mastering  Node.js
₱2806.99
Learning Node.js Development
₱2245.99
Total 7,859.97 Stars icon

Table of Contents

12 Chapters
Getting Set Up Chevron down icon Chevron up icon
Node Fundamentals – Part 1 Chevron down icon Chevron up icon
Node Fundamentals – Part 2 Chevron down icon Chevron up icon
Node Fundamentals – Part 3 Chevron down icon Chevron up icon
Basics of Asynchronous Programming in Node.js Chevron down icon Chevron up icon
Callbacks in Asynchronous Programming Chevron down icon Chevron up icon
Promises in Asynchronous Programming Chevron down icon Chevron up icon
Web Servers in Node Chevron down icon Chevron up icon
Deploying Applications to Web Chevron down icon Chevron up icon
Testing the Node Applications – Part 1 Chevron down icon Chevron up icon
Testing the Node Applications – Part 2 Chevron down icon Chevron up icon
Another Book You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Half star icon Empty star icon 3.6
(16 Ratings)
5 star 37.5%
4 star 18.8%
3 star 18.8%
2 star 12.5%
1 star 12.5%
Filter icon Filter
Top Reviews

Filter reviews by




Arthur Jose Germano Mar 25, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Hi, this book is amazing. It builds up knowledge from the scratch, with nice and very simple examples.It explains difficult concepts to grasp in an easy friendly way.And even for me, that english is not my first language, it is easy.So, if you don't know a thing about Node.js you definately should buy this book!I recommend it very much!
Amazon Verified review Amazon
Leo Vincey Jun 30, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book covers a lot of ground in its 629 pages. The author is a teacher and it shows. He has you download a lot of open source software and has you sign up with GitHub and Heroku. You build apps and learn about using the burgeoning world of Application Programming Interfaces (API). I may not remember it all, but at least the book introduced the most popular items in the fast-growing and collaborative world of Node.js. Now it is on to the same author's Advanced Node.js Development.
Amazon Verified review Amazon
AmazonCustomer Jul 12, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
A basic understanding of Javascript is required, since Node.js (js = JavaScript) uses JavaScript syntax. Other than that, Andrew walks the reader through every detail.I was getting frustrated with reading programming books that use foo(), bar(), baz() as impractical examples. Andrew uses real-life examples that the reader can apply immediately.Andrew has the gift of making the complex simple. Only a person who is a master of his craft has that talent.
Amazon Verified review Amazon
Chris Dec 24, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
So far in my reading Great Book. Informative breaking down the language to where you truly understand the essence of the philosophy behind it. Mead is a great instructor also,I've took so of his Use my courses also simply excellent.
Amazon Verified review Amazon
Wausau Coated Products, Inc. Apr 23, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I'm new to Node.js and have picked up various books on the topic. This book is the BEST one that I have found for learning the basics of Node.js. The author explain everything very clearly and provides excellent examples. If you are new to Node.js and looking for a resource to get you started, this is the best book that I have found.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.