MVMohit Vishwakarmainultimatenode.hashnode.dev·Feb 14, 2025 · 1 min readHow To Use An ES6 Import In Node.jsTo handle this issue, we use ES6 import By changing content of package.json file //package.json { "name": "index", "version": "1.0.0", "description": "", "main": "index.js", "type": "module", "scripts": { "test": "ech...00
MVMohit Vishwakarmainmohitv02.hashnode.dev·Feb 14, 2025 · 1 min readPRoMises chainingconst wait = function (second) { return new Promise(function (resolve) { setTimeout(resolve("WHo??"), second * 1000); }); }; wait(1) .then((r) => { console.log("I am a first call"); console.log(r); return wait(3); }) .then(...00
MVMohit Vishwakarmainultimatenode.hashnode.dev·Jan 23, 2025 · 3 min readJSON Data Handling in Node.jshis blog post provides a comprehensive guide on how to work with JSON data in Node.js, including creating JSON files, reading data, and converting JSON to JavaScript objects for web applications. n this blog post, we will explore how to effectively w...00
MVMohit Vishwakarmainultimatenode.hashnode.dev·Jan 23, 2025 · 2 min readImplementing Dynamic RoutingTo create a more dynamic routing system, we need to differentiate responses based on the URL entered by the user. Here’s how we can achieve this: Extracting the URL: We can access the requested URL through the request parameter in our callback funct...00
MVMohit Vishwakarmainultimatenode.hashnode.dev·Jan 22, 2025 · 3 min readAsynchronous Nature of Node.jsWhat is Synchronous Code? Synchronous code is executed line by line in the order it is written. Each statement must complete before the next one begins. For example, consider the following code snippet that reads a file using the readFileSync method:...00