Home » JavaScript » Node.js

Node.js

Caching of Modules in NodeJS

In this post, I am talking about caching of Modules in NodeJS. We have the following files 1 2 3 4 5 6 7 //greet.js module.exports = {     greeting: "Hello!",     greet: function(){         console.log(this.greeting);     } } 01 02 03 04 05 06 07 08 09 10 //app.js var greet1 = require("./module/greet"); greet1.greet(); greet1.greeting = "Yooo!"; greet1.greet();       var greet2 ...

Read More »

Exports vs module.exports in NodeJs, Which one to use?

We know that when our code is run through the node it’s wrapped in a function expression. This enables us to access the module object which is a parameter passed to that function. 1 2 3 (function (exports, require, module, __filename, __dirname) {     //module code }); This function expression is then invoked with the following arguments: 1 fn(module.exports, require, module, ...

Read More »

How NodeJs Processes Modules?

We all know that to execute a node application, we have to type the command. In this post, we’ll see how NodeJS processes Modules. whereapp.jsis the entry point to our application. But seldom do we wonder about what’s happening when we type this command. How does the node magically come to take our js file and executes it? This is ...

Read More »

V8 Engine and Introduction to NodeJS

Sharing is Caring This post is going to talk about V8 Engine and Introduction to NodeJS Processor Accepts instructions in a particular language (eg: IA-32, X86-64, ARM, MIPS…). We need to give instruction to a processor on a computer in the language it understands. The microprocessor inputs those instructions and executes them. Machine Code (or Machine Language) Programming languages understood ...

Read More »

19 Best Practices For Automation testing With Node.js

Node js has become one of the most popular frameworks in JavaScript today. Used by millions of developers, to develop thousands of project, node js is being extensively used. The more you develop, the better the testing you require to have a smooth, seamless application. This article shares the best practices for the testing node.in 2019, to deliver a robust ...

Read More »

Using Node 11.7 Worker Threads with RxJS Observable

With the release of Node 11.7, the worker_threads module becomes a standard feature and is no longer hidden behind the --experimental-worker switch. The worker_threads module allows developers to run JavaScript asynchronously in light-weight, isolated threads contained within the main Node process. This article will be focusing on how use worker threads to execute a task asynchronously and stream data from ...

Read More »

Develop RESTful APIs using MongoDB and Nodejs

In this article, we will learn how to build Restful API’s from scratch using node and NoSQL databases like MongoDB. For starters let’s understand our development stack before we start building our application. Node.js is an open source javascript runtime designed to build scalable applications and uses an event-driven and non-blocking I/O. Node.js is designed keeping low latency and streaming ...

Read More »

Beware the performance cost of async_hooks (Node 8)

I was excited about async_hooks having finally landed in Node.js 8, as it would enable me to share important troubleshooting information with all code involved in handling a particular request. However it turned out to have terrible impact of our CPU usage (YMMV):                 This was quite extreme and is likely related to ...

Read More »

Build a CRUD-y Single Page Application with Node and Angular

“I love writing authentication and authorization code.” ~ No Web Developer Ever. Tired of building the same login screens over and over? Try the Okta API for hosted authentication, authorization, and multi-factor auth. Even before the release of Angular 6, Angular had gone through some changes over the years. The biggest one was the jump from AngularJS (v1.x) to Angular ...

Read More »