Node.js: Setup Different Configuration Settings for Development & Production Server

This article shows how you can set up different configuration files for different servers like a production server or development server. For example, we can have different database configuration settings for development server and production server. If we write the database config settings (hostname, username, password) in the single file then we have to manually … Read more

Node.js: Include another JS, ENV, JSON file in the app

This article shows how you can include another JS (Javascript) file into your main application JS file. We can have a situation where we store configuration settings or database settings in another file. It can be .js, .env, .json or any other file. We will be using module.exports object to achieve this. I have created … Read more

Magento 2: Return JSON, XML, HTML & Raw Text Data Response from Controller

This article shows how you can return JSON data, XML data, HTML data, or Raw Text data from any Controller class in Magento 2. Generally, in the Magento2 controller’s execute() function, we see the redirect or forwarding call which redirects to the specified URL page. However, we might sometime need to return the JSON format … Read more

Magento 2: Create, Edit, Delete Customer Attribute Programmatically

This article shows how you can programmatically add or create a new customer attribute in Magento 2. It also shows how you can update and delete/remove the customer attribute programmatically in Magento 2. I will also show how you can add the product attributes from both Install Script and Upgrade Script: – Add customer attribute … Read more

Magento 2: Create Product Attribute, Attribute Group/Tab & Attribute Set Programmatically

This article shows how you can programmatically add or create a new product attribute, product attribute group, and product attribute set in Magento 2. In this article, we will be looking at the following: Create Product Attribute Update Product Attribute Remove Product Attribute Create Product Attribute Group/Tab Add Product Attributes to the Attribute Group/Tab Create … Read more

Node.js: Using Async/Await Function to Avoid Promise Chaining & Callback Hell

This article shows how you can use Async/Await function instead of Callback functions or Promise while writing the synchronous programming code in Node.js. Node.js is asynchronous/non-blocking in nature. If we want to execute certain code only after the execution of another code then we can use Callback functions. However, there can be a need of … Read more

Node.js: Using Promise to Avoid Callback Hell

This article shows how you can use Promise instead of Callback functions while writing the synchronous programming code in Node.js. Node.js is asynchronous/non-blocking in nature. If we want to execute certain code only after the execution of another code then we can use Callback functions. However, there can be a need of using nested callback … Read more

Node.js: Using Callback Functions for Synchronous Programming

Node.js code is asynchronous in nature. This article shows how you can use callback function in Node.js for synchronous programming. I have written an article with examples on synchronous and asynchronous programming in Node.js. Here’s the link: Node.js: Asynchronous & Synchronous Code Programming In the callback method, you simply pass a function as a parameter … Read more