<?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: Om Prakash Tiwari</title>
    <description>The latest articles on DEV Community by Om Prakash Tiwari (@optiwariindia).</description>
    <link>https://dev.to/optiwariindia</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%2F513410%2Fb30639d9-bc45-4d0d-af36-ed548c445dbe.jpeg</url>
      <title>DEV Community: Om Prakash Tiwari</title>
      <link>https://dev.to/optiwariindia</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/optiwariindia"/>
    <language>en</language>
    <item>
      <title>Axios Compromise: What Happened, Why It Matters, and What We Should Do Next</title>
      <dc:creator>Om Prakash Tiwari</dc:creator>
      <pubDate>Wed, 01 Apr 2026 01:26:01 +0000</pubDate>
      <link>https://dev.to/optiwariindia/axios-compromise-what-happened-why-it-matters-and-what-we-should-do-next-5d7i</link>
      <guid>https://dev.to/optiwariindia/axios-compromise-what-happened-why-it-matters-and-what-we-should-do-next-5d7i</guid>
      <description>&lt;p&gt;e point), it’s time to pause and rethink.&lt;/p&gt;

&lt;p&gt;Recently, concerns around dependency trust, supply chain attacks, and package compromise scenarios have once again highlighted a harsh truth:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Your biggest vulnerability might not be your code — it’s your dependencies.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  🚨 The Problem: Axios and the Supply Chain Risk
&lt;/h2&gt;

&lt;p&gt;Axios itself isn’t “evil” — but the ecosystem around it makes it risky.&lt;/p&gt;

&lt;p&gt;Here’s the real issue:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Axios is a &lt;strong&gt;third-party abstraction over HTTP&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;It pulls in &lt;strong&gt;dependencies (direct or indirect)&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;It’s updated frequently, often without deep audits in most projects&lt;/li&gt;
&lt;li&gt;It runs in &lt;strong&gt;highly sensitive contexts&lt;/strong&gt; (auth headers, tokens, cookies)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now imagine this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A malicious update gets published&lt;/li&gt;
&lt;li&gt;Or a dependency inside Axios gets compromised&lt;/li&gt;
&lt;li&gt;Or your lockfile gets bypassed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Suddenly:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Your &lt;strong&gt;Authorization headers can be intercepted&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Your &lt;strong&gt;requests can be modified&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Your &lt;strong&gt;data can be exfiltrated silently&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This isn’t hypothetical — supply chain attacks have already hit major packages in the JS ecosystem.&lt;/p&gt;

&lt;p&gt;And the worst part?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;You won’t even notice until it’s too late.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  ⚠️ Why Axios is Risky in Critical Systems
&lt;/h2&gt;

&lt;p&gt;From my perspective, the problem isn’t just Axios — it’s &lt;strong&gt;over-abstraction&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Axios introduces:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Hidden request transformations&lt;/li&gt;
&lt;li&gt;Interceptors that can be globally hijacked&lt;/li&gt;
&lt;li&gt;Silent behavior changes across versions&lt;/li&gt;
&lt;li&gt;Extra surface area for bugs or exploits&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Compare that with native &lt;code&gt;fetch&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Built-in&lt;/li&gt;
&lt;li&gt;Minimal&lt;/li&gt;
&lt;li&gt;Transparent&lt;/li&gt;
&lt;li&gt;No dependency risk&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When you're handling:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;JWT tokens&lt;/li&gt;
&lt;li&gt;Session management&lt;/li&gt;
&lt;li&gt;Internal APIs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You &lt;strong&gt;cannot afford hidden layers&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  ✅ The Solution: Own Your API Layer
&lt;/h2&gt;

&lt;p&gt;Instead of relying on external libraries, I strongly recommend:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Build your own API abstraction layer using native fetch.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That’s exactly what I do.&lt;/p&gt;

&lt;p&gt;Here’s the approach I use 👇&lt;/p&gt;




&lt;h2&gt;
  
  
  🧠 My API Class Strategy
&lt;/h2&gt;

&lt;p&gt;I created a custom &lt;code&gt;API&lt;/code&gt; class that:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Centralizes all API calls
&lt;/h3&gt;

&lt;p&gt;No scattered requests across the app.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Handles authentication automatically
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;token&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;token&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. Injects headers safely
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;defaultHeaders&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Content-Type&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;application/json&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;...(&lt;/span&gt;&lt;span class="nx"&gt;token&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;Authorization&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;`Bearer &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;token&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt; &lt;span class="p"&gt;}),&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  4. Handles token invalidation securely
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;status&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;401&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
  &lt;span class="nx"&gt;errorMessage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;token expired&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
  &lt;span class="nx"&gt;errorMessage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;jwt malformed&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;removeItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;token&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  5. Supports FormData without breaking headers
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt; &lt;span class="k"&gt;instanceof&lt;/span&gt; &lt;span class="nx"&gt;FormData&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;delete&lt;/span&gt; &lt;span class="nx"&gt;mergedHeaders&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Content-Type&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  6. Emits global error events
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dispatchEvent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;CustomEvent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;error-received&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;detail&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;status&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  7. Provides clean method wrappers
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;api&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/users&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nx"&gt;api&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/login&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nx"&gt;api&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;put&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/profile&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  💡 Why This Is Better Than Axios
&lt;/h2&gt;

&lt;p&gt;Here’s the real advantage:&lt;/p&gt;

&lt;h3&gt;
  
  
  🔒 Security
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;No third-party interception layer&lt;/li&gt;
&lt;li&gt;No dependency injection risk&lt;/li&gt;
&lt;li&gt;Full control over request lifecycle&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🧩 Transparency
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;You know exactly what’s happening&lt;/li&gt;
&lt;li&gt;No hidden interceptors&lt;/li&gt;
&lt;li&gt;No magic transformations&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  ⚡ Performance
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;No extra abstraction overhead&lt;/li&gt;
&lt;li&gt;Native browser optimization&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🛠 Flexibility
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Add custom logic anytime&lt;/li&gt;
&lt;li&gt;Extend without fighting a library&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🧠 Developer Mindset Shift
&lt;/h2&gt;

&lt;p&gt;We need to stop thinking:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Which library should I use?”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And start thinking:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Do I even need a library for this?”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For something as critical as API calls:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Simplicity beats abstraction&lt;/li&gt;
&lt;li&gt;Control beats convenience&lt;/li&gt;
&lt;li&gt;Native beats dependency&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🚀 Final Take
&lt;/h2&gt;

&lt;p&gt;I’m not saying Axios is unusable.&lt;/p&gt;

&lt;p&gt;I’m saying:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;It’s not worth the risk in security-critical systems.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If your app:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Handles authentication&lt;/li&gt;
&lt;li&gt;Talks to internal APIs&lt;/li&gt;
&lt;li&gt;Processes sensitive data&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then you should strongly consider:&lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;Dropping Axios&lt;/strong&gt;&lt;br&gt;
👉 &lt;strong&gt;Using native fetch&lt;/strong&gt;&lt;br&gt;
👉 &lt;strong&gt;Building your own API layer (like the one above)&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>cybersecurity</category>
      <category>javascript</category>
      <category>npm</category>
      <category>security</category>
    </item>
    <item>
      <title>Why I switched Back to Cookie</title>
      <dc:creator>Om Prakash Tiwari</dc:creator>
      <pubDate>Thu, 15 Jan 2026 02:46:48 +0000</pubDate>
      <link>https://dev.to/optiwariindia/why-i-switched-back-to-cookie-3coe</link>
      <guid>https://dev.to/optiwariindia/why-i-switched-back-to-cookie-3coe</guid>
      <description>&lt;p&gt;At some point, most developers go through this phase where &lt;strong&gt;cookies feel ancient&lt;/strong&gt;.&lt;br&gt;
Like table layouts or jQuery—&lt;em&gt;“we’ve moved on from that, right?”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I thought the same.&lt;br&gt;
I moved away from cookies… and then slowly, painfully, came back.&lt;/p&gt;

&lt;p&gt;Here’s why.&lt;/p&gt;


&lt;h2&gt;
  
  
  Cookies: Great Until They Weren’t
&lt;/h2&gt;

&lt;p&gt;In the beginning, cookies were easy.&lt;br&gt;
They just worked.&lt;/p&gt;

&lt;p&gt;But then reality hit:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;cookie&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Anyone with JavaScript access could read them.&lt;br&gt;
One XSS bug and boom—your auth token is gone.&lt;/p&gt;

&lt;p&gt;That was enough for me to say:&lt;br&gt;
&lt;strong&gt;“Nope. Cookies are unsafe.”&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;So I left.&lt;/p&gt;




&lt;h2&gt;
  
  
  Session Storage: Felt Safer, Wasn’t
&lt;/h2&gt;

&lt;p&gt;Next, I tried &lt;code&gt;sessionStorage&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The logic was simple:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Tab closes → data gone&lt;/li&gt;
&lt;li&gt;Less persistence → less risk&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But guess what?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;JavaScript can still read it&lt;/li&gt;
&lt;li&gt;XSS still wins&lt;/li&gt;
&lt;li&gt;Accidentally close the tab → user logged out&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Security-wise, it wasn’t better.&lt;br&gt;
UX-wise, it was worse.&lt;/p&gt;




&lt;h2&gt;
  
  
  Local Storage: Convenient but Dangerous
&lt;/h2&gt;

&lt;p&gt;Then came &lt;code&gt;localStorage&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Persistent. Simple. Popular.&lt;/p&gt;

&lt;p&gt;Also:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fully readable by JavaScript&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;gold mine for XSS attacks&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Tokens just sitting there, waiting to be stolen&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At this point I realized something uncomfortable:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Every solution I tried had the same weakness.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  The Real Problem Was JavaScript Access
&lt;/h2&gt;

&lt;p&gt;It finally clicked.&lt;/p&gt;

&lt;p&gt;The issue wasn’t:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;cookies&lt;/li&gt;
&lt;li&gt;session storage&lt;/li&gt;
&lt;li&gt;local storage&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The issue was this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;If JavaScript can read your token, attackers can too.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So instead of finding &lt;em&gt;new storage&lt;/em&gt;, I went back to the old one—&lt;br&gt;
but used it &lt;strong&gt;correctly&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Cookies, Take Two (HttpOnly This Time)
&lt;/h2&gt;

&lt;p&gt;This time, I used cookies with rules:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;HttpOnly&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Secure&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;SameSite&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;HTTPS only&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;JavaScript can’t touch the token&lt;/li&gt;
&lt;li&gt;XSS can’t steal it&lt;/li&gt;
&lt;li&gt;Browser sends it automatically&lt;/li&gt;
&lt;li&gt;Backend stays clean and predictable&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Suddenly… cookies made sense again.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Irony
&lt;/h2&gt;

&lt;p&gt;After all the modern solutions, I ended up with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Better security&lt;/li&gt;
&lt;li&gt;Cleaner auth flow&lt;/li&gt;
&lt;li&gt;Less frontend complexity&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Using something that existed all along.&lt;/p&gt;

&lt;p&gt;Turns out cookies weren’t bad.&lt;br&gt;
&lt;strong&gt;We were just using them wrong.&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Final Thought
&lt;/h2&gt;

&lt;p&gt;Security isn’t about what’s trendy.&lt;br&gt;
It’s about &lt;strong&gt;what attackers can’t access&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;And right now?&lt;br&gt;
A properly configured &lt;code&gt;HttpOnly&lt;/code&gt; cookie is one of the hardest places to steal from.&lt;/p&gt;

&lt;p&gt;So yeah—I switched back to cookies.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Web Development in Docker Containers Using Express.js</title>
      <dc:creator>Om Prakash Tiwari</dc:creator>
      <pubDate>Wed, 06 Nov 2024 04:43:51 +0000</pubDate>
      <link>https://dev.to/optiwariindia/web-development-in-docker-containers-using-expressjs-3k3l</link>
      <guid>https://dev.to/optiwariindia/web-development-in-docker-containers-using-expressjs-3k3l</guid>
      <description>&lt;p&gt;In today’s fast-paced development landscape, containerization has emerged as a game-changing approach for web developers, providing environments that are consistent, portable, and easy to manage. Docker, the most popular containerization platform, enables developers to create and manage containers easily, making development and deployment smoother. Combining Docker with Node.js frameworks like Express.js brings further agility to web development, allowing developers to create, test, and deploy web applications with ease.&lt;/p&gt;

&lt;p&gt;In this article, we’ll explore how to set up and develop an Express.js application inside a Docker container, focusing on the advantages it brings to web development.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Use Docker for Web Development?
&lt;/h2&gt;

&lt;p&gt;Docker encapsulates the application's dependencies within a container, which means:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Consistency across environments:&lt;/strong&gt; Docker containers run the same way on any system that has Docker installed, eliminating "it works on my machine" issues.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Isolation:&lt;/strong&gt; Docker provides an isolated environment for your application, ensuring that it doesn’t interfere with other applications.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scalability and Deployment:&lt;/strong&gt; Containers allow easy scaling and deployment, making it simple to expand applications horizontally.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For web development using Express.js, Docker ensures that Node.js and any other dependencies (like databases or libraries) are correctly configured within an environment separate from the host system.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting Up an Express.js Application in Docker
&lt;/h2&gt;

&lt;p&gt;Let's dive into the steps required to set up and run an Express.js application inside a Docker container.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Initialize an Express.js Application
&lt;/h3&gt;

&lt;p&gt;First, create a basic Express.js application. If you don’t have it installed globally, you can run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx express-generator myapp
&lt;span class="nb"&gt;cd &lt;/span&gt;myapp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This creates a basic folder structure and a few default files for an Express.js app. Next, install any necessary dependencies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2: Write a Dockerfile
&lt;/h3&gt;

&lt;p&gt;A Dockerfile defines the environment and instructions needed to set up and run your application. Here’s an example Dockerfile for an Express.js application:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="c"&gt;# Use an official Node.js image as the base&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;node:latest&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;AS&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;development&lt;/span&gt;

&lt;span class="c"&gt;# Create and set the working directory inside the container&lt;/span&gt;
&lt;span class="k"&gt;WORKDIR&lt;/span&gt;&lt;span class="s"&gt; /app&lt;/span&gt;

&lt;span class="c"&gt;# Copy package.json and package-lock.json files to the container&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; package*.json ./&lt;/span&gt;

&lt;span class="c"&gt;# Install dependencies&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt;

&lt;span class="c"&gt;# Copy the entire application code to the container&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; . .&lt;/span&gt;

&lt;span class="c"&gt;# Expose the port the app runs on&lt;/span&gt;
&lt;span class="k"&gt;EXPOSE&lt;/span&gt;&lt;span class="s"&gt; 3000&lt;/span&gt;

&lt;span class="c"&gt;# Run the application&lt;/span&gt;
&lt;span class="k"&gt;CMD&lt;/span&gt;&lt;span class="s"&gt; ["npm", "start"]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 3: Create a Docker Compose File (Optional)
&lt;/h3&gt;

&lt;p&gt;If your application has multiple services (e.g., a database), docker-compose.yml helps define and manage them. Here’s a sample docker-compose.yml file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;services&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;app&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;.&lt;/span&gt;
    &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;3000:3000"&lt;/span&gt;
    &lt;span class="na"&gt;volumes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;.:/app&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;/app/node_modules&lt;/span&gt;
    &lt;span class="na"&gt;environment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;NODE_ENV=development&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 4: Build and Run the Docker Container
&lt;/h3&gt;

&lt;p&gt;To create a container for your application, open a terminal in the application’s root directory (where the Dockerfile is located) and run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker build &lt;span class="nt"&gt;-t&lt;/span&gt; express-app &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, to run the container, use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker run &lt;span class="nt"&gt;-p&lt;/span&gt; 3000:3000 express-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The application should now be accessible at &lt;a href="http://localhost:3000" rel="noopener noreferrer"&gt;http://localhost:3000&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 5: Developing with Live Reloading
&lt;/h3&gt;

&lt;p&gt;By default, Docker doesn’t support live reloading (where changes in code are automatically reflected). However, you can achieve this with the help of nodemon, a tool that watches for file changes and restarts the server automatically.&lt;/p&gt;

&lt;p&gt;First, install nodemon as a development dependency:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--save-dev&lt;/span&gt; nodemon
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, update the Dockerfile to set NODE_ENV to development and update the start command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="c"&gt;# Install nodemon globally&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; nodemon

&lt;span class="c"&gt;# Run the application using nodemon&lt;/span&gt;
&lt;span class="k"&gt;CMD&lt;/span&gt;&lt;span class="s"&gt; ["nodemon", "bin/www"]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or if you're using docker-compose.yml, you can specify the command directly in it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;nodemon bin/www&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This setup enables live reloading, which is highly beneficial during development as it saves time and enhances productivity.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 6: Managing Dependencies with Docker Volumes
&lt;/h3&gt;

&lt;p&gt;To avoid issues where dependencies are rebuilt each time, use Docker volumes to mount the local file system’s source code into the container.&lt;/p&gt;

&lt;p&gt;In docker-compose.yml:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;volumes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;.:/app&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;/app/node_modules&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This configuration syncs your code between the host and container, but it doesn’t override the node_modules folder.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 7: Debugging Inside Docker
&lt;/h3&gt;

&lt;p&gt;Docker provides various options for debugging. You can add DEBUG flags to your application to increase logging verbosity or use Docker’s own logging and monitoring commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker logs &lt;span class="nt"&gt;-f&lt;/span&gt; &amp;lt;container-id&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 8: Dockerizing for Production
&lt;/h3&gt;

&lt;p&gt;When moving to production, there are additional steps for optimization, such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Using multi-stage builds to reduce image size.&lt;/li&gt;
&lt;li&gt;Setting up environment-specific configurations.&lt;/li&gt;
&lt;li&gt;Adding security measures, like scanning for vulnerabilities.
An example of a multi-stage build Dockerfile:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="c"&gt;# Stage 1: Build the dependencies&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;node:20&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;AS&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;build&lt;/span&gt;
&lt;span class="k"&gt;WORKDIR&lt;/span&gt;&lt;span class="s"&gt; /app&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; package*.json ./&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--production&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; . .&lt;/span&gt;

&lt;span class="c"&gt;# Stage 2: Use a lightweight base for production&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt; node:20-slim&lt;/span&gt;
&lt;span class="k"&gt;WORKDIR&lt;/span&gt;&lt;span class="s"&gt; /app&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; --from=build /app .&lt;/span&gt;
&lt;span class="k"&gt;EXPOSE&lt;/span&gt;&lt;span class="s"&gt; 3000&lt;/span&gt;
&lt;span class="k"&gt;CMD&lt;/span&gt;&lt;span class="s"&gt; ["node", "bin/www"]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Advantages of Developing with Express.js in Docker&lt;br&gt;
Developing an Express.js application in Docker has significant advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Platform Consistency:&lt;/strong&gt; The Docker container standardizes your environment across all stages, from development to production.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Simplified Dependencies:&lt;/strong&gt; By encapsulating dependencies, you eliminate complex installations on your local machine.
Rapid Scaling: Containers allow you to scale applications horizontally by deploying additional instances.
Effortless Collaboration: Sharing a Dockerfile or docker-compose.yml ensures that teammates work in the exact environment.
## Best Practices&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keep Docker Images Small:&lt;/strong&gt; Use multi-stage builds to minimize image size and improve performance.
Use Environment Variables for Configuration: Avoid hard-coding configurations to keep the container environment-agnostic.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Leverage Volumes:&lt;/strong&gt; Utilize Docker volumes for storing data or syncing code in development.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Automate with CI/CD:&lt;/strong&gt; Incorporate Docker into CI/CD pipelines for consistent and automated deployment across environments.
## Conclusion
Dockerizing your Express.js application provides a scalable and robust solution for web development. By using Docker, you gain better control over environments, simplify dependency management, and improve collaboration, all of which are critical for modern web development. Whether you’re working on a simple application or a complex system with multiple services, Docker provides tools that can streamline your workflow and set your project up for success in production.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Get started with Docker and Express.js today to see how it can transform your development experience!&lt;/p&gt;

</description>
      <category>docker</category>
      <category>express</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Develop your code online using vscode-tunnel</title>
      <dc:creator>Om Prakash Tiwari</dc:creator>
      <pubDate>Wed, 06 Nov 2024 04:25:44 +0000</pubDate>
      <link>https://dev.to/optiwariindia/develop-your-code-online-using-vscode-tunnel-161k</link>
      <guid>https://dev.to/optiwariindia/develop-your-code-online-using-vscode-tunnel-161k</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;It has been a great hastle to work in teams on same project without having a good infrastructure. It has been observed that we (frontend/backend developers) generate multiple versions of code on different machines and sometimes older code is pushed again on the repository breaking some changes causing bugs in some running component/feature. While development on a "on premise development server" becomes a great hastle and difficult to mange. The Production server cannot have option to install a test version of the code and share to developers due to security issues.&lt;/p&gt;

&lt;p&gt;VS Code has came with a feature called remote development and has introduced vscode-tunnel to allow developers share code between machnines. This is very helpful if we are working in the same network with single github account or taking paid plans from microsoft to manage multiple accounts in the same tunnel.&lt;/p&gt;

&lt;p&gt;While working on this issue, we have developed a docker image to create vscode tunnel using a single line of code.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to use
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;To install docker, based on your operating system, follow instructions at &lt;a href="https://docs.docker.com/engine/install/" rel="noopener noreferrer"&gt;https://docs.docker.com/engine/install/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now open command prompt and run following command:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Replace /path/to/sourcecode to path as in your computer
docker run -d -v /path/to/sourcecode:/home/node/workspace --name vscode-tunnel-server optiwariindia/vscode-tunnel
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;After starting this container open Logs for the container using command below:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  docker logs vscode-tunnel-server
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will return some instructions that you can follow to connect it with your github account.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To access the code open vscode.dev and select "Connect to tunnel" button and follow instructions.&lt;/li&gt;
&lt;li&gt;Once connected to tunnel, click on "Open folder" and select your workspace work.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>vscode</category>
      <category>remotedevelopment</category>
      <category>vscodetunnel</category>
      <category>optiwariindia</category>
    </item>
    <item>
      <title>Deepawali, the Festival of Lights</title>
      <dc:creator>Om Prakash Tiwari</dc:creator>
      <pubDate>Thu, 31 Oct 2024 11:32:48 +0000</pubDate>
      <link>https://dev.to/optiwariindia/deepawali-the-festival-of-lights-51j3</link>
      <guid>https://dev.to/optiwariindia/deepawali-the-festival-of-lights-51j3</guid>
      <description>&lt;p&gt;Deepawali, the Festival of Lights, is one of the most significant and joyous festivals celebrated in India. It is a festival that symbolizes the victory of light over darkness, good over evil, and knowledge over ignorance. Deepawali is a five-day festival that starts with Dhanteras, followed by Chhoti Deepawali, Badi Deepawali, Govardhan Puja, and ends with Bhai Dooj. Each day of this festival holds its own significance and is celebrated with unique traditions and rituals.&lt;/p&gt;

&lt;h2&gt;
  
  
  Dhanteras
&lt;/h2&gt;

&lt;p&gt;Dhanteras marks the beginning of the Deepawali celebrations. It is considered an auspicious day to make new purchases, especially gold and silver, as it is believed to bring wealth and prosperity. The legend associated with Dhanteras is that of a young prince whose life was threatened by a venomous snake on the 13th day of the dark fortnight of the Hindu month of Kartik. To protect the prince, his mother placed a pile of precious metals and jewels in front of his door. The snake was mesmerized by the glittering treasure and did not harm the prince. Since then, Dhanteras has been celebrated as the day to purchase precious metals and to worship Goddess Lakshmi, the goddess of wealth.&lt;/p&gt;

&lt;h2&gt;
  
  
  Chhoti Deepawali
&lt;/h2&gt;

&lt;p&gt;Chhoti Deepawali, also known as Naraka Chaturdashi, is the second day of the Deepawali celebrations. On this day, people clean their homes and workplaces to welcome Goddess Lakshmi. They also decorate their homes with diyas (earthen lamps) and rangoli (colorful floor designs). The legend associated with Chhoti Deepawali is that of Lord Krishna defeating the demon Narakasura. It is believed that Lord Krishna killed Narakasura on this day, and to commemorate his victory, people celebrate Chhoti Deepawali.&lt;/p&gt;

&lt;h2&gt;
  
  
  Badi Deepawali
&lt;/h2&gt;

&lt;p&gt;Badi Deepawali is the main day of the Deepawali celebrations. On this day, people light diyas and candles in their homes and workplaces to symbolize the victory of light over darkness. They also worship Goddess Lakshmi and Lord Ganesha to seek their blessings for wealth, prosperity, and wisdom. The legend associated with Badi Deepawali is that of Lord Rama returning to Ayodhya after defeating Ravana. It is believed that the people of Ayodhya lit diyas to welcome Lord Rama and his wife Sita.&lt;/p&gt;

&lt;h2&gt;
  
  
  Govardhan Puja
&lt;/h2&gt;

&lt;p&gt;Govardhan Puja is celebrated on the fourth day of Deepawali. On this day, people worship Mount Govardhan, which is considered to be a symbol of nature and the provider of sustenance. The legend associated with Govardhan Puja is that of Lord Krishna lifting Mount Govardhan to protect the people of Braj from the wrath of Indra, the god of rain.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bhai Dooj
&lt;/h2&gt;

&lt;p&gt;Bhai Dooj is the last day of the Deepawali celebrations. On this day, sisters apply tilak to their brothers' foreheads and pray for their long life and prosperity. In return, brothers give gifts to their sisters. The legend associated with Bhai Dooj is that of Yamraj, the god of death, visiting his sister Yami on this day. Yami welcomed her brother with love and affection, and Yamraj was so pleased that he promised to protect her brother. Since then, Bhai Dooj has been celebrated as a day to strengthen the bond between siblings.&lt;/p&gt;

&lt;p&gt;Deepawali is a festival that brings joy, happiness, and prosperity to the lives of people. It is a time to celebrate the triumph of good over evil and to strengthen family bonds. The stories and legends associated with Deepawali teach us the importance of values like courage, compassion, and devotion.&lt;/p&gt;

</description>
      <category>deepawali</category>
      <category>hindufestivals</category>
      <category>optsir</category>
      <category>etutorials</category>
    </item>
    <item>
      <title>PHP Developer with Twig knowledge can start expressjs project with twig in few moment</title>
      <dc:creator>Om Prakash Tiwari</dc:creator>
      <pubDate>Mon, 01 Aug 2022 08:06:00 +0000</pubDate>
      <link>https://dev.to/optiwariindia/journey-from-php-to-express-js-with-php-twig-465g</link>
      <guid>https://dev.to/optiwariindia/journey-from-php-to-express-js-with-php-twig-465g</guid>
      <description>&lt;h1&gt;
  
  
  The Background
&lt;/h1&gt;

&lt;p&gt;As a PHP Developer I was used to work with twig template engine like most of the PHP Developers. I found the twig engine is supported by express js as well and also my teammates were using this extensively. I have decied to use the same template engine for my projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  Starting the first project
&lt;/h2&gt;

&lt;p&gt;If you are from PHP Background and using twig template engine, and want to switch to express js, then you can follow the below steps to download the boilerplate code for express and setup your project automatically.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Install nodejs (Latest version) from &lt;a href="https://nodejs.org/en/download/"&gt;https://nodejs.org/en/download/ (the official website)&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Open Command prompt (Windows) or Terminal (Mac/Linux) and run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npx start-express [project-name]&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;-- [project-name] is the name of your project.
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This will generate a directory with your project name and add essentials into it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Open the directory in your text editor. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Run the following command to start the server in development mode:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm run devstart&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;You can now access your project in your browser on port 3000.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A readme file is also generated for more information. You can go through it for more details.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
