Learn NodeJS in 1 Day: Complete Node JS Guide with Examples
3/5
()
About this ebook
Node.js supports both client and server side applications. It is based on JavaScript and is very fast in operation. These distinctive features made node.js as one of the most powerful framework in the Java Ecosystem. JavaScript alone allows you to build real-time and scalable mobile and web applications. With this e-book, you will explore more on the node.js framework and how to use it efficiently for web development.
Average developers or beginners who struggle to understand node.js basics will find this book very helpful and productive. The book tried to put examples that simplify problems usually faced by the users like how asynchronous code works, what are modules, how big file can be read, node.js express, etc. You will find that lots of concepts that take a long time to master can be learned in a day or two.
If this is your first interaction with node.js and don’t want all sort of troubles that arise with the node, this edition is recommended. After going through this e-book, node.js will become an absolute pleasure.
Table of content
Chapter 1: Introduction
What is node.js
Why use Node.js
Features of Node.js
When to use and not use Node.js
Chapter 2: Download & Install Node.js
How to install node.js
Installing node through a package manager
Running your first Hello world application in Node.js
Chapter 3: Modules
What are modules in Node.js
Using modules in Node.js
Creating NPM modules
Extending modules
Publishing NPM Modules
Managing third party packages with npm
What is the package.json file
Chapter 4: Create Server and Get Data
Chapter 5: Node.js with Express
What is Express.js
Installing and using Express
What are Routes
Sample Web server using express.js
Chapter 6: Node.js with MongoDB
Node.js and NoSQL Databases
Using MongoDB and Node.js
How to build a node express app with MongoDB to store and serve content
Chapter 7: Promise, Generator, Event and Filestream
What are promises
Callbacks to promises
Generating promises with the BlueBird library
Creating a custom promise
Callbacks vs generators
Filestream in Node.js
Emitting Events
Chapter 8: Testing with Jasmine
Overview of Jasmine for testing Node.js applications
How to use Jasmine to test Node.js applications
Related to Learn NodeJS in 1 Day
Related ebooks
50 Recipes for Programming Node.js Rating: 3 out of 5 stars3/5React.js Essentials Rating: 4 out of 5 stars4/5Node.js Web Development - Third Edition Rating: 2 out of 5 stars2/5Node.js Design Patterns Rating: 4 out of 5 stars4/5Web Development with MongoDB and Node.js Rating: 0 out of 5 stars0 ratingsDeploying Node.js Rating: 5 out of 5 stars5/5Node.js Design Patterns - Second Edition Rating: 4 out of 5 stars4/5Mastering Node.js Rating: 1 out of 5 stars1/5Mongoose for Application Development Rating: 5 out of 5 stars5/5Node.JS Guidebook: Comprehensive guide to learn Node.js Rating: 0 out of 5 stars0 ratingsLearning Node.js for Mobile Application Development Rating: 0 out of 5 stars0 ratingsMastering JavaScript Single Page Application Development Rating: 0 out of 5 stars0 ratingsJavascript For Beginners: Your Guide For Learning Javascript Programming in 24 Hours Rating: 3 out of 5 stars3/5Node.js, JavaScript, API: Interview Questions and Answers Rating: 5 out of 5 stars5/5Web Development with MongoDB and NodeJS - Second Edition Rating: 0 out of 5 stars0 ratingsReact and React Native Rating: 0 out of 5 stars0 ratingsExpress in Action: Writing, building, and testing Node.js applications Rating: 4 out of 5 stars4/5Node Web Development, Second Edition Rating: 0 out of 5 stars0 ratingsBuilding Scalable Apps with Redis and Node.js Rating: 0 out of 5 stars0 ratingsMEAN Web Development Rating: 5 out of 5 stars5/5Vue.js for Jobseekers: A complete guide to learning Vue.js, building projects, and getting hired (English Edition) Rating: 0 out of 5 stars0 ratingsMastering JavaScript Promises Rating: 1 out of 5 stars1/5Web Application Development with MEAN Rating: 0 out of 5 stars0 ratingsReact Projects: Build 12 real-world applications from scratch using React, React Native, and React 360 Rating: 0 out of 5 stars0 ratingsReactJS by Example - Building Modern Web Applications with React Rating: 4 out of 5 stars4/5React: Building Modern Web Applications Rating: 5 out of 5 stars5/5React Deep Dive Rating: 5 out of 5 stars5/5
Internet & Web For You
More Porn - Faster!: 50 Tips & Tools for Faster and More Efficient Porn Browsing Rating: 3 out of 5 stars3/5Hacking : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Ethical Hacking Rating: 5 out of 5 stars5/5Introduction to Internet Scams and Fraud: Credit Card Theft, Work-At-Home Scams and Lottery Scams Rating: 4 out of 5 stars4/5Coding For Dummies Rating: 5 out of 5 stars5/5Cybersecurity For Dummies Rating: 4 out of 5 stars4/5The Logo Brainstorm Book: A Comprehensive Guide for Exploring Design Directions Rating: 4 out of 5 stars4/5Beginner's Guide To Starting An Etsy Print-On-Demand Shop Rating: 0 out of 5 stars0 ratingsHow To Make Money Blogging: How I Replaced My Day-Job With My Blog and How You Can Start A Blog Today Rating: 4 out of 5 stars4/5The Digital Marketing Handbook: A Step-By-Step Guide to Creating Websites That Sell Rating: 5 out of 5 stars5/5Wireless Hacking 101 Rating: 4 out of 5 stars4/5Tor and the Dark Art of Anonymity Rating: 5 out of 5 stars5/5The $1,000,000 Web Designer Guide: A Practical Guide for Wealth and Freedom as an Online Freelancer Rating: 5 out of 5 stars5/5Coding All-in-One For Dummies Rating: 4 out of 5 stars4/5Social Engineering: The Science of Human Hacking Rating: 3 out of 5 stars3/5Six Figure Blogging Blueprint Rating: 5 out of 5 stars5/5200+ Ways to Protect Your Privacy: Simple Ways to Prevent Hacks and Protect Your Privacy--On and Offline Rating: 0 out of 5 stars0 ratingsGrokking Algorithms: An illustrated guide for programmers and other curious people Rating: 4 out of 5 stars4/5SEO For Dummies Rating: 4 out of 5 stars4/5The Beginner's Affiliate Marketing Blueprint Rating: 4 out of 5 stars4/5How To Start A Podcast Rating: 4 out of 5 stars4/5Remote/WebCam Notarization : Basic Understanding Rating: 3 out of 5 stars3/5The Internet Is Not What You Think It Is: A History, a Philosophy, a Warning Rating: 4 out of 5 stars4/5Podcasting For Dummies Rating: 4 out of 5 stars4/5The Cyber Attack Survival Manual: Tools for Surviving Everything from Identity Theft to the Digital Apocalypse Rating: 0 out of 5 stars0 ratingsHow to Be Invisible: Protect Your Home, Your Children, Your Assets, and Your Life Rating: 4 out of 5 stars4/5No Place to Hide: Edward Snowden, the NSA, and the U.S. Surveillance State Rating: 4 out of 5 stars4/5
Reviews for Learn NodeJS in 1 Day
3 ratings0 reviews
Book preview
Learn NodeJS in 1 Day - Krishna Rungta
author.
Table Of Content
Chapter 1: Introduction
What is node.js
Why use Node.js
Features of Node.js
When to use and not use Node.js
Chapter 2: Download & Install Node.js
How to install node.js
Installing node through a package manager
Running your first Hello world application in Node.js
Chapter 3: Modules
What are modules in Node.js
Using modules in Node.js
Creating NPM modules
Extending modules
Publishing NPM Modules
Managing third party packages with npm
What is the package.json file
Chapter 4: Create Server and Get Data
Chapter 5: Node.js with Express
What is Express.js
Installing and using Express
What are Routes
Sample Web server using express.js
Chapter 6: Node.js with MongoDB
Node.js and NoSQL Databases
Using MongoDB and Node.js
How to build a node express app with MongoDB to store and serve content
Chapter 7: Promise, Generator, Event and Filestream
What are promises
Callbacks to promises
Generating promises with the BlueBird library
Creating a custom promise
Callbacks vs generators
Filestream in Node.js
Emitting Events
Chapter 8: Testing with Jasmine
Overview of Jasmine for testing Node.js applications
How to use Jasmine to test Node.js applications
Chapter 1: Introduction
The modern web application has really come a long way over the years with the introduction of many popular frameworks such as bootstrap, Angular JS, etc. All of these frameworks are based on the popular JavaScript framework.
But when it came to developing server based applications there was just kind of a void, and this is where Node.js came into the picture.
Node.js is also based on the JavaScript framework, but it is used for developing server-based applications. While going through the entire tutorial, we will look into Node.js in detail and how we can use it to develop server based applications.
What is node.js
Node.js is an open-source, cross-platform runtime environment used for development of server-side web applications. Node.js applications are written in JavaScript and can be run on a wide variety of operating systems.
Node.js is based on an event-driven architecture and a non-blocking Input/Output API that is designed to optimize an application's throughput and scalability for real-time web applications.
Over a long period of time, the framework available for web development were all based on a stateless model. A stateless model is where the data generated in one session (such as information about user settings and events that occurred) is not maintained for usage in the next session with that user.
A lot of work had to be done to maintain the session information between requests for a user. But with Node.js there is finally a way for web applications to have a real-time, two-way connections, where both the client and server can initiate communication, allowing them to exchange data freely.
Why use Node.js
We will have a look into the real worth of Node.js in the coming chapters, but what is it that makes this framework so famous. Over the years, most of the applications were based on a stateless request-response framework. In these sort of applications, it is up to the developer to ensure the right code was put in place to ensure the state of web session was maintained while the user was working with the system.
But with Node.js web applications, you can now work in real-time and have a 2-way communication. The state is maintained, and the either the client or server can start the communication.
Features of Node.js
Let's look at some of the key features of Node.js
Asynchronous event driven IO helps concurrent request handling – This is probably the biggest selling points of Node.js. This feature basically means that if a request is received by Node for some Input/Output operation, it will execute the operation in the background and continue with processing other requests.
This is quite different from other programming languages. A simple example of this is given in the code below
var fs = require('fs');
fs.readFile(Sample.txt
,function(error,data)
{
console.log(Reading Data completed
);
});
The above code snippet looks at reading a file called Sample.txt. In other programming languages, the next line of processing would only happen once the entire file is read.
But in the case of Node.js the important fraction of code to notice is the declaration of the function ('function(error,data)'). This is known as a callback function.
So what happens here is that the file reading operation will start in the background. And other processing can happen simultaneously while the file is being read. Once the file read operation is completed, this anonymous function will be called and the text Reading Data completed
will be written to the console log.
2) Node uses the V8 JavaScript Runtime engine, the one which is used by Google Chrome. Node has a wrapper over the JavaScript engine which makes the runtime engine much faster and hence processing of requests within Node