<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Nipu Chakraborty</title>
    <description>The latest articles on DEV Community by Nipu Chakraborty (@nipu).</description>
    <link>https://dev.to/nipu</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F673265%2F9d538053-e6e2-4868-93a5-8c99bbb2e1ae.jpeg</url>
      <title>DEV Community: Nipu Chakraborty</title>
      <link>https://dev.to/nipu</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nipu"/>
    <language>en</language>
    <item>
      <title>nginx default configuration file understand</title>
      <dc:creator>Nipu Chakraborty</dc:creator>
      <pubDate>Fri, 22 Sep 2023 06:55:35 +0000</pubDate>
      <link>https://dev.to/nipu/nginx-default-configuration-file-understand-k37</link>
      <guid>https://dev.to/nipu/nginx-default-configuration-file-understand-k37</guid>
      <description>&lt;h1&gt;
  
  
  Where you will find default conf file and what will be it's name in linux?
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Ans:&lt;/strong&gt; &lt;code&gt;/etc/nginx/nginx.conf&lt;/code&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Explanation of file
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Ans:&lt;/strong&gt; &lt;br&gt;
let's see what has in this file&lt;br&gt;
run this command&lt;br&gt;
&lt;code&gt;nano /etc/nginx/nginx.conf&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You will get this output&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;user  nginx;
worker_processes  auto;

error_log  /var/log/nginx/error.log notice;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    include /etc/nginx/conf.d/*.conf;
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;let's explain line by line&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;user nginx; :&lt;/strong&gt; This sets the user under which the Nginx worker processes will run. In this case, it's set to the "Nginx" user, it's enhance security by limiting the processes and permissions&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;worker_processes auto; :&lt;/strong&gt; This will determine the number of worker process that Nginx will be handling for the incoming request. It will choose an automatic number of worker processes based on CPU.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;error_log /var/log/nginx/error.log notice; :&lt;/strong&gt; This will store your error log in the indicated location you can check here if you face any error during the run of the server.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;pid /var/run/nginx.pid;:&lt;/strong&gt; This file contains the master process ID. in a defined location.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;events { ... }:&lt;/strong&gt; In this section Nginx handle events like how Nginx handle connections and events like incoming request by default it has &lt;strong&gt;1024&lt;/strong&gt; worker connections but you can change it as per your need.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;http { ... }:&lt;/strong&gt; This section actually handles all HTTP configurations for the server here we can include &lt;br&gt;
&lt;code&gt;include /etc/nginx/mime.types;&lt;/code&gt; which actually contain all types of file extensions like &lt;code&gt;.jpg .png .txt .html&lt;/code&gt; ... etc. and &lt;br&gt;
&lt;code&gt;default_type application/octet-stream;&lt;/code&gt; this section set default MIME type that doesn't have an explicitly defined type. &lt;br&gt;
&lt;code&gt;log_format main&lt;/code&gt; here you can define the log format for every request.&lt;br&gt;
&lt;code&gt;access_log /var/log/nginx/access.log main;&lt;/code&gt; In this section, you can set the location and format for the access log file. It will keep every single request log with details. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;sendfile on;&lt;/code&gt; by doing this you are giving permission to send file system calls so that static files can be served efficiently. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;keepalive_timeout 65;&lt;/code&gt; In this section, you can set a timeout for keep-alive client connections. by default, it has 65 sec but you can set your own time.&lt;br&gt;
&lt;code&gt;include /etc/nginx/conf.d/*.conf;&lt;/code&gt; by doing this you can include additional configuration files from the &lt;code&gt;/etc/nginx/conf.d/&lt;/code&gt; directory. Basically, when you think your configuration script going too big you can separate by doing this.&lt;/p&gt;

&lt;p&gt;Thank you&lt;br&gt;
You can find me on &lt;a href="https://www.linkedin.com/in/nipuchakraborty/" rel="noopener noreferrer"&gt;linkedin&lt;/a&gt; connect with me to get more information like this.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>programming</category>
      <category>linux</category>
      <category>nginx</category>
    </item>
    <item>
      <title>Solve Cross Browser Compatibility Issues</title>
      <dc:creator>Nipu Chakraborty</dc:creator>
      <pubDate>Fri, 08 Sep 2023 05:24:46 +0000</pubDate>
      <link>https://dev.to/nipu/solve-cross-browser-compatibility-issues-1jc</link>
      <guid>https://dev.to/nipu/solve-cross-browser-compatibility-issues-1jc</guid>
      <description>&lt;h2&gt;
  
  
  STEP-1: After write code validate HTML and css
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Write well know and and align code &lt;/li&gt;
&lt;li&gt;Insert comment for better understand&lt;/li&gt;
&lt;li&gt;Indentation match and ensure open-closing tag&lt;/li&gt;
&lt;li&gt;Use Jigsaw css validator&lt;/li&gt;
&lt;li&gt;Use Js formatter for javascript code and HTML&lt;/li&gt;
&lt;li&gt;Use Css lint and eslint&lt;/li&gt;
&lt;li&gt;validate with w3school html validator and solve the issue.&lt;/li&gt;
&lt;li&gt;Before/after write code always check with browser support 
I mentioned here some tools [BrowserStack(paid),Browserling(free+paid), IE NetRenderer(free)]&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  STEP 2: Use css reset and html reset
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;You can use Normalize.css&lt;/li&gt;
&lt;li&gt;HTML5 Reset and&lt;/li&gt;
&lt;li&gt;Eric Meyer’s Reset CSS&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  STEP 3: Maintain Layout structure.
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Always use HTML viewport metatag&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.w3schools.com/css/css3_multiple_columns.asp" rel="noopener noreferrer"&gt;CSS Multiple Columns&lt;/a&gt; click here to know more&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.w3schools.com/css/css3_flexbox.asp" rel="noopener noreferrer"&gt;CSS Flexbox &lt;/a&gt; and &lt;a href="https://www.w3schools.com/howto/howto_css_image_grid_responsive.asp" rel="noopener noreferrer"&gt;Grid&lt;/a&gt; click to know more&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  STEP 4: Detect feature so during development
&lt;/h2&gt;

&lt;p&gt;Here I mentioned some tools&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://modernizr.com/" rel="noopener noreferrer"&gt;modernizr&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Glossary/Polyfill" rel="noopener noreferrer"&gt;Polyfill&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  STEP 5:
&lt;/h2&gt;

&lt;p&gt;Test on real device you can also use some tools like &lt;strong&gt;browserstack&lt;/strong&gt; but I will recomend real device always better.&lt;/p&gt;

&lt;h2&gt;
  
  
  STEP 6:
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Always keep update you libaray and packages&lt;/li&gt;
&lt;li&gt;Use modern frontend frameworks as like reactJs, VueJs or AngularJs and keep up to date it's a good practice&lt;/li&gt;
&lt;li&gt;Always use big comunity support frameworks so that you get better support for feature.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Thanks for your time:&lt;br&gt;
You can reach me at : &lt;a href="https://www.linkedin.com/in/nipuchakraborty" rel="noopener noreferrer"&gt;https://www.linkedin.com/in/nipuchakraborty&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>html</category>
      <category>css</category>
      <category>javascript</category>
    </item>
    <item>
      <title>JavaScript Function Closures</title>
      <dc:creator>Nipu Chakraborty</dc:creator>
      <pubDate>Wed, 06 Sep 2023 10:13:31 +0000</pubDate>
      <link>https://dev.to/nipu/javascript-function-closures-56io</link>
      <guid>https://dev.to/nipu/javascript-function-closures-56io</guid>
      <description>&lt;h2&gt;
  
  
  What closure actully do?
&lt;/h2&gt;

&lt;p&gt;Suppose you have a simple pice of code like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let value = 1
function multiply(){
   value = value * 2;
   console.log(value)
}  
multiply() // output: 2
multiply() // output: 4
multiply() // output: 8
console.log(value) // 8
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;if you see here we have a variable in global scope and a function what multiply value*2 and assign it to value variable and console it.&lt;br&gt;
Now take another code&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function multiply(){
   let value = 1
   value = value * 2;
   console.log(value)
}  
multiply() // output : 2
multiply() // output : 2
console.log(value) // output: ReferenceError: value is not defined
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;if you see here we have a variable in functional scope and a function what multiply &lt;code&gt;value*2&lt;/code&gt; and assign it to value variable and console it.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  let's discuss what is the difference in this two codes ?
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Now discuss about variable life time&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;In first code variable has life time util close the window or nevigate another page as it is in global scope&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In second code variable has life time util function execution. After complete the execution of this it will be destroy all variable. for this reason when I console value in 2nd code get &lt;code&gt;ReferenceError: value is not defined&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;I think you identify the problem already if you are clever. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In First code when I am trying to get updated value and it happend because it update in global scope variable and we know global scope exist util nevigate or close window that's why we are getting expected result.&lt;/p&gt;

&lt;p&gt;But when I created a function after execution it will delete all variable and execution steps that's why when I try to get value it will always getting 2. Now what is the solutions the solutions is I need something what will do this in innerscope and throw it after execute in global scope so that we can get updated value. &lt;br&gt;
let's do this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function multiply() {
  let value = 1;
  function mul() {
     value = value * 2;
  }
  mul();  
  return value; 
}
const mul1 = multiply()
const mul2 = multiply()
console.log(mul1, mul2) //output 2 2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Still problem not solved expected 4 but getting 2 let's solve this by return insted of value variable let's return the the inner/nested function&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function multiply () {
  let value = 1;
  function mul() {
      value = value * 2; 
      return value
  }
 return mul
};

const mul = multiply()
console.log(mul()) // 2
console.log(mul()) // 4
console.log(mul()) // 8
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  So finally define what is Closures?
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;A closure is a feature of JavaScript that allows inner functions to access the outer scope of a function. Closure helps in binding a function to its outer boundary and is created automatically whenever a function is created.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>node</category>
    </item>
    <item>
      <title>Docker Best Practices for Production</title>
      <dc:creator>Nipu Chakraborty</dc:creator>
      <pubDate>Sat, 02 Sep 2023 18:59:48 +0000</pubDate>
      <link>https://dev.to/nipu/docker-best-practices-for-production-24i0</link>
      <guid>https://dev.to/nipu/docker-best-practices-for-production-24i0</guid>
      <description>&lt;h2&gt;
  
  
  1. Always use specific version
&lt;/h2&gt;

&lt;p&gt;❌ Don't do this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FROM node
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ Do this because it will ensure your container image version&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FROM node:20.0.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Try to use alpine version
&lt;/h2&gt;

&lt;p&gt;❌ Don't do this because It can be use large&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FROM node:20.0.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ Do this for small official image&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FROM node:20.0.0-alpine
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Dont install all dependencies
&lt;/h2&gt;

&lt;p&gt;❌ Don't do this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;RUN npm install
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ Do this because you don't need dev dependencies in your production server&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;RUN npm install --production
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. Mantain versioning
&lt;/h2&gt;

&lt;p&gt;❌ Don't do this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker build -t myapp .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ Do this it will help you to track version of your container images.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker build -t myapp:1.0 .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>docker</category>
      <category>devops</category>
      <category>webdev</category>
      <category>linux</category>
    </item>
    <item>
      <title>Automating the installation of Docker on Linux using a shell script</title>
      <dc:creator>Nipu Chakraborty</dc:creator>
      <pubDate>Sun, 27 Aug 2023 07:44:01 +0000</pubDate>
      <link>https://dev.to/nipu/automat-your-docker-install-3lf3</link>
      <guid>https://dev.to/nipu/automat-your-docker-install-3lf3</guid>
      <description>&lt;p&gt;Create a .sh file file by opening your terminal&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;touch docker-auto-install.sh&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;after that open the file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nano docker-auto-install.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and Write this code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash

echo "Updating linux...."
sudo apt-get update
echo "Installing ca-certificates curl and gnupg..."
sudo apt-get install ca-certificates curl gnupg
echo "Add Docker's official GPG key:"
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

# Add Docker repository
echo \
  "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  "$(. /etc/os-release &amp;amp;&amp;amp; echo "$VERSION_CODENAME")" stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list &amp;gt; /dev/null

echo "Update package index again to include Docker repository"
apt update

echo "Installing Docker Engine..."
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

echo "Starting and enabling Docker service"
systemctl start docker
systemctl enable docker

echo "Docker installed and started successfully."
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After complete save this file by &lt;code&gt;ctrl+s&lt;/code&gt;&lt;br&gt;
and for exit press &lt;code&gt;ctrl + x&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Make the script executable: chmod +x docker-auto-install.sh&lt;br&gt;
Run the script with root privileges: sudo ./docker-auto-install.sh&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.fiverr.com/s/VLr4pB" rel="noopener noreferrer"&gt;fiverr&lt;/a&gt;&lt;/p&gt;

</description>
      <category>docker</category>
      <category>linux</category>
      <category>automation</category>
      <category>bash</category>
    </item>
    <item>
      <title>Database Transactions</title>
      <dc:creator>Nipu Chakraborty</dc:creator>
      <pubDate>Wed, 05 Jul 2023 06:43:20 +0000</pubDate>
      <link>https://dev.to/nipu/database-transactions-3km3</link>
      <guid>https://dev.to/nipu/database-transactions-3km3</guid>
      <description>&lt;h2&gt;
  
  
  What is Transaction?
&lt;/h2&gt;

&lt;p&gt;A database transaction is a unit of work performed on a database that consists of multiple steps or operations. It is a fundamental concept in database systems and ensures the consistency and reliability of data.&lt;/p&gt;

&lt;p&gt;In a transaction, a set of database operations is grouped together to form a single logical unit. These operations can include inserting, updating, deleting, or retrieving data from one or multiple database tables. The transaction can involve changes to multiple records or tables, and it represents a specific task or business operation.&lt;/p&gt;

&lt;p&gt;Transactions follow the ACID properties, which stands for:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Atomicity: A transaction is atomic, meaning that it is treated as a single indivisible unit of work. It either executes in its entirety, or none of its operations are applied to the database. If any operation fails within the transaction, the entire transaction is rolled back, and the database is restored to its state before the transaction started.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Consistency: A transaction brings the database from one consistent state to another consistent state. It ensures that all integrity constraints, rules, and relationships defined in the database schema are maintained during the transaction. If a transaction violates any constraints, the database reverts to its original state.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Isolation: Transactions execute in isolation from each other, as if they were the only ones operating on the database. This property ensures that concurrent transactions do not interfere with each other's intermediate results. It prevents issues such as dirty reads (reading uncommitted data), non-repeatable reads (reading different data in subsequent reads), and phantom reads (reading new rows that appear during a transaction).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Durability: Once a transaction is committed and changes are applied to the database, they are permanent and survive any subsequent system failures. The committed data is stored securely and can be recovered in case of a crash, power outage, or any other catastrophic event.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Database transactions are crucial for maintaining data integrity, ensuring data consistency, and providing concurrency control in multi-user environments. They allow complex operations and modifications to be performed reliably and accurately on a database, even in the presence of concurrent access by multiple users or applications.&lt;/p&gt;

&lt;p&gt;Let see an example with typescript and TypeORM &lt;/p&gt;

&lt;p&gt;before start make a &lt;strong&gt;User entity&lt;/strong&gt; with username, email and password&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { createConnection, getConnection } from "typeorm";
import { User } from "./entities/User";

async function performTransaction(): Promise&amp;lt;void&amp;gt; {
  // Create a new database connection
  const connection = await createConnection();

  // Start a transaction
  await connection.transaction(async (entityManager) =&amp;gt; {
    try {
      // Create a new user
      const newUser = new User();
      newUser.username = "JohnDoe";
      newUser.email = "johndoe@example.com";
      newUser.password = "password123";

      // Save the user in the transaction
      await entityManager.save(newUser);

      // Update the user's email
      newUser.email = "john.doe@example.com";

      // Save the updated user in the transaction
      await entityManager.save(newUser);

      // Commit the transaction
      await entityManager.commit();

      console.log("Transaction committed successfully.");
    } catch (error) {
      // Rollback the transaction if an error occurs
      await entityManager.rollback();
      console.error("Transaction rolled back due to an error:", error);
    }
  });

  // Close the connection
  await getConnection().close();
}

// Call the transaction function
performTransaction().catch((error) =&amp;gt; {
  console.error("Error occurred:", error);
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>javascript</category>
      <category>database</category>
      <category>node</category>
      <category>typescript</category>
    </item>
    <item>
      <title>How Javascript works? (Bangla)</title>
      <dc:creator>Nipu Chakraborty</dc:creator>
      <pubDate>Thu, 18 May 2023 08:26:59 +0000</pubDate>
      <link>https://dev.to/nipu/how-javascript-works-bangla-3822</link>
      <guid>https://dev.to/nipu/how-javascript-works-bangla-3822</guid>
      <description>&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/m7NUKB0BkjA"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
      <category>node</category>
    </item>
    <item>
      <title>Single Thread JavaScript</title>
      <dc:creator>Nipu Chakraborty</dc:creator>
      <pubDate>Thu, 18 May 2023 08:25:40 +0000</pubDate>
      <link>https://dev.to/nipu/single-thread-javascript-1816</link>
      <guid>https://dev.to/nipu/single-thread-javascript-1816</guid>
      <description>&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/tclxnuzy2AQ"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>node</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>How JavaScript call stack works?(Bangla)</title>
      <dc:creator>Nipu Chakraborty</dc:creator>
      <pubDate>Thu, 18 May 2023 08:24:37 +0000</pubDate>
      <link>https://dev.to/nipu/how-javascript-call-stack-worksbangla-5a16</link>
      <guid>https://dev.to/nipu/how-javascript-call-stack-worksbangla-5a16</guid>
      <description>&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/WJbgauQM9zg"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
      <category>node</category>
    </item>
    <item>
      <title>JavaScript Event loop (Bangla)</title>
      <dc:creator>Nipu Chakraborty</dc:creator>
      <pubDate>Thu, 18 May 2023 08:23:20 +0000</pubDate>
      <link>https://dev.to/nipu/javascript-event-loop-bangla-4660</link>
      <guid>https://dev.to/nipu/javascript-event-loop-bangla-4660</guid>
      <description>&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/hAOAT8LJ3iA"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
      <category>node</category>
    </item>
    <item>
      <title>JavaScript Founder &amp; history (Bangla language)</title>
      <dc:creator>Nipu Chakraborty</dc:creator>
      <pubDate>Thu, 18 May 2023 08:20:58 +0000</pubDate>
      <link>https://dev.to/nipu/javascript-founder-history-bangla-language-4jgc</link>
      <guid>https://dev.to/nipu/javascript-founder-history-bangla-language-4jgc</guid>
      <description>&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/_tO8t-TIL9c"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>node</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>.js, .cjs and .mjs defference</title>
      <dc:creator>Nipu Chakraborty</dc:creator>
      <pubDate>Mon, 15 May 2023 10:24:15 +0000</pubDate>
      <link>https://dev.to/nipu/js-cjs-and-mjs-defference-5f21</link>
      <guid>https://dev.to/nipu/js-cjs-and-mjs-defference-5f21</guid>
      <description>&lt;p&gt;CJS, MJS, and .JS are file extensions used to denote different types of JavaScript files. Here's the difference between them:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;.JS (JavaScript):&lt;br&gt;
The .js extension is the most common file extension for JavaScript files. It is used to indicate that a file contains JavaScript code. .js files can be executed in different JavaScript environments, such as web browsers, servers, and other JavaScript runtime environments.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;CJS (CommonJS):&lt;br&gt;
CommonJS is a module system for JavaScript used in server-side environments like Node.js. The CJS module format allows you to define modules using the &lt;code&gt;require&lt;/code&gt; and &lt;code&gt;module.exports&lt;/code&gt; syntax. In CommonJS, each file is treated as a separate module, and you can import/export functionality between modules using &lt;code&gt;require&lt;/code&gt; and &lt;code&gt;module.exports&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;CommonJS modules are typically used in Node.js applications and other server-side JavaScript environments. You will often find files with the .js extension using the CommonJS module format.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;MJS (ECMAScript Modules):
MJS is an extension used for JavaScript files that adhere to the ECMAScript Modules (ESM) specification. ECMAScript modules are part of the JavaScript language standard and provide a more modern and standardized way to define modules.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;ECMAScript modules use the &lt;code&gt;import&lt;/code&gt; and &lt;code&gt;export&lt;/code&gt; keywords to define dependencies and expose functionality between modules. Unlike CommonJS, which is primarily used in server-side environments, ECMAScript modules can be used both in browsers and server-side environments that support them.&lt;/p&gt;

&lt;p&gt;The MJS extension is often used to indicate that a JavaScript file uses the ECMAScript module format, making it easier to differentiate between files that use CommonJS and ECMAScript modules.&lt;/p&gt;

&lt;p&gt;In summary, .js files are the general extension for JavaScript files, while CJS and MJS are extensions used to specify the module formats (CommonJS and ECMAScript Modules) used in JavaScript files for different environments and purposes.&lt;br&gt;
Here are some examples to illustrate the usage of each file extension: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;.JS (JavaScript):
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// script.js
function sayHello() {
  console.log("Hello, world!");
}

sayHello();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;CJS (CommonJS):
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// moduleA.js
const message = "Hello, from Module A!";
module.exports = message;

// moduleB.js
const messageA = require("./moduleA");
console.log(messageA);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;MJS (ECMAScript Modules):
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// moduleA.mjs
const message = "Hello, from Module A!";
export default message;

// moduleB.mjs
import messageA from "./moduleA";
console.log(messageA);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the first example, the .js file contains regular JavaScript code that can be executed in any JavaScript environment.&lt;/p&gt;

&lt;p&gt;The second example demonstrates the use of CommonJS modules. Each file is treated as a separate module, and the module.exports statement is used to expose functionality from one module to another. The require statement is used to import the exported functionality.&lt;/p&gt;

&lt;p&gt;The third example showcases ECMAScript modules. The MJS extension is used to indicate that the JavaScript file adheres to the ECMAScript module format. The export statement is used to expose functionality, and the import statement is used to import the exported functionality from other modules.&lt;/p&gt;

&lt;p&gt;Please note that the usage of CJS or MJS modules depends on the specific JavaScript runtime or environment being used.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://nodejs.org/docs/latest/api/esm.html#esm_differences_between_es_modules_and_commonjs" rel="noopener noreferrer"&gt;ref&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>es6</category>
      <category>node</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
