Node.js Essentials
eBook - ePub

Node.js Essentials

  1. 118 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Node.js Essentials

About this book

From client to server, learn how Node.js can help you use JavaScript more effectively to develop faster and more scalable applications with ease

About This Book

  • Discover how Node.js can transform the way you develop both the front and back ends - offering a much more modern and integrated form of web development
  • Create, debug, and test a complete full-stack application using Node.js and other powerful tools
  • From creating a server from scratch to unit testing code, learn how Node.js extends the possibilities of JavaScript development

Who This Book Is For

If you want to expand your capabilities as a developer this book is for you. Covering everything you need to use Node.js effectively, you will soon be able to handle JavaScript in a much more fully-realised way.

What You Will Learn

  • Create and use an HTTP server using Express.js
  • Configure environmental variables, arguments, and config files
  • Use a Key/Value NoSQL database with Node to store data
  • Create a client-side application using Node and Node.Webkit
  • Debug applications using Node.Inspector
  • Create a library that can be used in more than one project
  • Install packages from NPM

In Detail

Node.js is simply a tool that lets you useJavaScript on the server side. But it actually does much more than that – by extending JavaScript it allows for a much more integrated and efficient approach to development. It's no surprise that it's a fundamental tool for full-stack JavaScript developers. Whether your working on the back end or front end – by using Node.js you're adopting a much more collaborative and agile way of working – so you and your team can focus on delivering a quality end product. This will ensure you're ready to take on any new challenges that get thrown at you.

NodeJS Essentials takes you through the fundamentals of Node.JS and demonstrates how Node.js can transform the way you work with JavaScript and take greater control over your code.

You will also learn how to create a HTTP server from scratch, route requests, create a RESTful interface, and authenticate users. You will also learn to debug applications using Node.Inspector and the importance of logging, as well as creating a reusable library.Finally, you'll find out how to test and optimizr your code when working with Node.js using the Mocha framework. Follow each step and discover how to test both synchronous and asynchronous code using Mocha unit tests.

With Node.js Essentials you'll find everything you need to create a complete full-stack application with Node.js. It will help you harness JavaScript much more effectively – and in doing so expand your confidence and capabilities as a developer.

Style and approach

This concise guide will help you get up and running with Node.js. Packed with easy to followexamples, you'll be be able to build a complete full-stack application utilizing Node's capabilities.

Tools to learn more effectively

Saving Books

Saving Books

Keyword Search

Keyword Search

Annotating Text

Annotating Text

Listen to it instead

Listen to it instead

Information

Node.js Essentials


Table of Contents

Node.js Essentials
Credits
About the Author
About the Reviewer
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Getting Started
Setting up
Hello require
Hello npm
Summary
2. Simple HTTP
Introducing routing
Summary
3. Authentication
Basic authentication
Bearer tokens
OAuth
Summary
4. Debugging
Logging
Error handling
Summary
5. Configuration
JSON files
Environmental variables
Arguments
Summary
6. Level DB and NoSQL
Level DB
MongoDB
Summary
7. Socket.IO
Rooms
Authentication
Summary
8. Creating and Deploying Packages
Creating npm packages
Summary
9. Unit Testing
Installing mocha
Chai
Stubbing methods
Summary
10. Using More Than JavaScript
CoffeeScript
Code blocks and functions
The existential operator
Objects and arrays
Classes
Summary
Index

Node.js Essentials

Copyright Ā© 2015 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: November 2015
Production reference: 1301015
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78528-492-2
www.packtpub.com

Credits

Author
Fabian Cook
Reviewers
Shoubhik Bose
Glenn Geenen
Commissioning Editor
Edward Gordan
Acquisition Editor
Divya Poojari
Content Development Editor
Athira Laji
Technical Editor
Naveenkumar Jain
Copy Editor
Sneha Singh
Project Coordinator
Harshal Ved
Proofreader
Safis Editing
Indexer
Hemangini Bari
Production Coordinator
Shantanu N. Zagade
Cover Work
Shantanu N. Zagade

About the Author

Fabian Cook is an experienced JavaScript developer who lives in Hawkes Bay, New Zealand. He began working with Java and C# very early in his life, which lead to using Node.js in an open source context. He is now currently working for a New Zealand ISP, known as NOW NZ where they are utilizing the full power of Node.js, Docker and CoreOS.

About the Reviewer

Glenn Geenen is a Node.js developer with a background in game and mobile development. He has mostly worked as an iOS consultant before becoming a Node.js consultant for his company, GeenenTijd.

www.PacktPub.com

Support files, eBooks, discount offers, and more

For support files and downloads related to your book, please visit www.PacktPub.com.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
Support files, eBooks, discount offers, and more
https://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.

Why subscribe?

  • Fully searchable across every book published by Packt
  • Copy and paste, print, and bookmark content
  • On demand and accessible via a web browser

Free access for Packt account holders

If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view 9 entirely free books. Simply use your login credentials for immediate access.

Preface

Node.js is simply a tool that lets you use JavaScript on the server side. However, it actually does much more than that – by extending JavaScript, it allows for a much more integrated and efficient approach to development. It comes as no surprise that it's a fundamental tool for full-stack JavaScript developers. Whether you work on the backend or frontend, you adopt a much more collaborative and agile way of working using Node.js, so that you and your team can focus on delivering a quality end product. This will ensure that you're ready to take on any new challenge that gets thrown at you.
This book will be fast paced and cover dependency management, running your own HTTP server, real time communication, and everything in between that is needed to get up and running with Node.js.

What this book covers

Chapter 1, Getting Started, covers the setup of Node.js. You will also cover how to utilize and manage dependencies.
Chapter 2, Simple HTTP, covers how to run a simple HTTP server and helps you understand routing and utilization of middleware.
Chapter 3, Authentication, covers the utilization of middleware and JSON Web Token to authenticate users.
Chapter 4, Debugging, covers the integration of post-mortem techniqu...

Table of contents

  1. Node.js Essentials

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn how to download books offline
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 990+ topics, we’ve got you covered! Learn about our mission
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more about Read Aloud
Yes! You can use the Perlego app on both iOS and Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app
Yes, you can access Node.js Essentials by Fabian Cook in PDF and/or ePUB format, as well as other popular books in Computer Science & Web Programming. We have over one million books available in our catalogue for you to explore.