Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
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

eBook
£17.99 £26.99
Paperback
£32.99
Subscription
Free Trial
Renews at £16.99p/m

What do you get with a Packt Subscription?

Free for first 7 days. £16.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
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 : 9781788395540
Languages :
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. £16.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

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

Packt Subscriptions

See our plans and pricing
Modal Close icon
£16.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
£169.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 £5 each
Feature tick icon Exclusive print discounts
£234.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 £5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total £ 116.97
Node Cookbook
£41.99
Mastering  Node.js
£41.99
Learning Node.js Development
£32.99
Total £ 116.97 Stars icon
Banner background image

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

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.