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....
The current date can be formatted by using Nodejs modules like Date Object or libraries like moment.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....
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....
Node.js relies on various dependencies under the hood for providing various features....
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....
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....
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....
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....
The trim() function is a string function of Node.js which is used to remove white spaces from the string....
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....
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....