How to Run Many Parallel HTTP Requests using Node.js ?
We know NodeJS application is single-threaded. Say, if processing involves request A that takes 10 seconds, it does not mean that a request which comes after this request needs to wait 10 seconds to start processing because NodeJS event loops are only single-threaded. The entire NodeJS architecture is not single-threaded....
read more
How to format the current date in MM/DD/YYYY HH:MM:SS format using Node?
The current date can be formatted by using Nodejs modules like Date Object or libraries like moment.js....
read more
How to Return JSON using Node.js ?
Node.js is a powerful platform for building server-side applications and returning JSON data is a common task in web development, especially when building APIs. JSON stands for JavaScript Object Notation. It is one of the most widely used formats for exchanging information across applications. Node.js supports various frameworks that help to make the processes smoother. The following ways cover how to return JSON data in our application from Node.js. This article will guide you through the process of setting up a simple Node.js server that returns JSON data in response to client requests....
read more
How to redirect back to original URL in Node.js ?
Node.js with the help of Express, supports web page routing. This means that when the client makes different requests, the application is routed to different web pages depending upon the request made and the routing methods defined. To learn more about Node.js routing and its implementation, refer this article....
read more
Libuv in Node.js
Node.js relies on various dependencies under the hood for providing various features....
read more
When to use next() and return next() in Node.js ?
In Node.js, particularly when working with the Express framework, middleware functions play a crucial role in handling requests. Two commonly used patterns within these middleware functions are next() and return next(). Understanding when and how to use these can significantly affect the flow and functionality of your application....
read more
Difference between module.exports and exports in Node.js
The module is a plain JavaScript Object representing the current module. It is local to each module and also it is private. It has exports property which is a plain JavaScript variable, set to module.exports. At the end of the file, Node.js return module.exports to the required function....
read more
How to Read a File Line by Line using Node.js ?
The ability to Read a File Line by Line using Node allows us to read large files without entirely storing them in memory. It is useful in saving resources and improving the efficiency of the application. It allows us to look for the information that is required and once the relevant information is found, we can stop the search process and can prevent unwanted memory usage....
read more
Difference between tilde ( ~ ) and caret ( ^ ) in package.json
When we open our package.json file and search for the dependency property and in there we find the packages that are listed as a nested object of the dependency property package-name:package-version. Now look at the package version, we find some numbers separated by three dots....
read more
Node.js trim() function
The trim() function is a string function of Node.js which is used to remove white spaces from the string....
read more
How to check if a string is valid MongoDB ObjectId in Node.js ?
MongoDB ObjectId: MongoDB creates a unique 12 bytes ID for every object using the timestamp of respective Object creation.This ObjectId can be used to uniquely target a specific object in the database....
read more
How to Use jQuery with Node.js ?
jQuery is a popular JavaScript library primarily used for client-side scripting to simplify HTML document traversal, event handling, animation, and AJAX interactions. Although jQuery is designed for the browser, you might find scenarios where you want to use it on the server side with Node.js, such as for web scraping or manipulating HTML documents. In this article, we’ll explore how to use jQuery with Node.js....
read more