CategoryEssentials

Build a Command-Line App in Node.js with Yargs

B

Consider a circumstance where you’re building a terminal project using Node.js. One way to parse arguments would be to use the process.argv array, which is shown below: var myArgs = process.argv.slice(2); console.log("Your website name: ", myArgs[0]); console.log("Your favorite number", myArgs[1]); This will be the output: While this might work, there is a minor flaw with the...

GitHub OAuth2.0 Authentication

G

This module allows you to use GitHub OAuth2.0 authentication in your Node.js apps. GitHub authentication may be simply and unobtrusively implemented into any application or framework that supports Connect-style middleware, such as Express, by linking into Passport. What is Git Hub GitHub is a web-based version control repository with around 20 million users worldwide. It is the world’s...

Deploy Node JS and Express REST API on Heroku

D

Hey folks! In this tutorial, we will be seeing how we can deploy Node JS and Express Rest API on Heroku. One of Heroku’s main advantages is that you can simply add resources to your project in the form of add-ons. Databases, logging and monitoring tools, CI and CD tools, and testing tools are examples of external resources. Let’s have a look at how to add a new resource to your...

Connecting a React JS application with node JS

C

This tutorial is all about connecting a React JS application with Node JS but before jumping right into it let’s just get familiar with ReactJS and NodeJS. React JS: React JS is an open-source JavaScript library for creating single-page applications with a focus on user interfaces. It has a strong developer community and is extensively used for creating SPAs (Single Page Applications). Node...

How to connect MongoDB using mongoose in Node JS

H

Mongoose.js is a Node.js library that connects your MongoDB clusters or collections to your Node.js application. You can use it to construct schemas for your documents. When it comes to generating and working with schemas, Mongoose has a lot to offer. We’ll look at how to connect a MongoDB instance to a Node.js application in this tutorial. What is MongoDB MongoDB is one of the most popular...

OAuth2.0 Authentication with Node JS and PassportJS

O

There are a lot of authentication methods for web applications and one of them is passport js. It allows you to use Google to authenticate your Node.js applications. Google authentication may be simply and unobtrusively implemented into any application. Passportjs is a popular choice for frameworks supporting Connect-style middleware. Hence, it is widely used with Express. So without further...

How to use Ejs templates with node js

H

Embedded JavaScript is abbreviated as EJS. It’s a simple templating language/engine that allows users to produce HTML using only JavaScript. When you need to output HTML with a lot of JavaScript, EJS comes in handy. You’ll learn how to use ejs templates with node js, how to incorporate repeating areas of your site, and how to send data to views in this tutorial. Prerequisites A common...

Generators in NodeJS

G

This tutorial is all about Generators in NodeJS and their differences with Callback. So without further delay let’s dive right in. What are generators? In recent years, Generators are getting more and more popular day by day in Node.js. This popularity is because of what Generators are capable of doing.  These are the function executions that can be paused and played later.The concept of...

WebSockets in NodeJS part 2

W

Welcome to Websockets in NodeJS part 2. In this part, we will be implementing the client-side and the server-side in this part, and after that WebSockets will come into action. So, without any further delay let’s jump right in. Implementing the server The first step is to implement the server-side javascript. Type the following code in a file named index.js. const express = require('express')...

Promises in NodeJS tutorial (part 1)

P

In this Promises in NodeJS tutorial and we will be discussing promises in detail from introduction to implementing promises. This tutorial is in two parts and this is the first part of Promises in NodeJS. So let’s jump right into this tutorial. What are promises? Before starting with promises, let’s revise ‘callback” functions in NodeJS. We have already discussed callbacks in detail in...

Tutor Network