<?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>Forem: Alim Mohammad</title>
    <description>The latest articles on Forem by Alim Mohammad (@alimalim77).</description>
    <link>https://forem.com/alimalim77</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%2F793572%2Ffdc7d5aa-72de-4414-9302-7e1de80d2af5.png</url>
      <title>Forem: Alim Mohammad</title>
      <link>https://forem.com/alimalim77</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/alimalim77"/>
    <language>en</language>
    <item>
      <title>Token Types Explained 🔑</title>
      <dc:creator>Alim Mohammad</dc:creator>
      <pubDate>Mon, 19 Jan 2026 05:11:06 +0000</pubDate>
      <link>https://forem.com/alimalim77/token-types-explained-284d</link>
      <guid>https://forem.com/alimalim77/token-types-explained-284d</guid>
      <description>&lt;h1&gt;
  
  
  1. Access Token
&lt;/h1&gt;

&lt;p&gt;What it is: A short-lived token (usually 15-30 mins) that grants access to protected endpoints.&lt;/p&gt;

&lt;p&gt;User logs in → Gets access token → Uses it for 30 mins → Token expires → Must login again&lt;/p&gt;

&lt;p&gt;Problem: User has to login again every 30 minutes! 😤&lt;/p&gt;

&lt;h1&gt;
  
  
  2. Refresh Token (🆕 To Implement)
&lt;/h1&gt;

&lt;p&gt;What it is: A long-lived token (days/weeks) used ONLY to get new access tokens.&lt;/p&gt;

&lt;p&gt;Why needed: Better user experience - they stay logged in without re-entering password.&lt;/p&gt;

&lt;h2&gt;
  
  
  Flow:
&lt;/h2&gt;

&lt;p&gt;┌──────────────────────────────────────────────────────────────────────┐&lt;br&gt;
│                                                                      │&lt;br&gt;
│   LOGIN                                                              │&lt;br&gt;
│   ──────                                                             │&lt;br&gt;
│   User sends email + password                                        │&lt;br&gt;
│                    ↓                                                 │&lt;br&gt;
│   Server returns:                                                    │&lt;br&gt;
│   • access_token (expires in 30 min)                                 │&lt;br&gt;
│   • refresh_token (expires in 7 days)                                │&lt;br&gt;
│                                                                      │&lt;br&gt;
├──────────────────────────────────────────────────────────────────────┤&lt;br&gt;
│                                                                      │&lt;br&gt;
│   USING THE API (for 30 mins)                                        │&lt;br&gt;
│   ───────────────────────────                                        │&lt;br&gt;
│   User sends: Authorization: Bearer                    │&lt;br&gt;
│   Server: ✅ Allowed                                                 │&lt;br&gt;
│                                                                      │&lt;br&gt;
├──────────────────────────────────────────────────────────────────────┤&lt;br&gt;
│                                                                      │&lt;br&gt;
│   ACCESS TOKEN EXPIRES (after 30 mins)                               │&lt;br&gt;
│   ─────────────────────────────────────                              │&lt;br&gt;
│   User sends: Authorization: Bearer                    │&lt;br&gt;
│   Server: ❌ 401 Unauthorized - Token expired                        │&lt;br&gt;
│                                                                      │&lt;br&gt;
│   User sends: POST /api/v1/users/refresh                             │&lt;br&gt;
│               Body: {"refresh_token": "..."}                         │&lt;br&gt;
│   Server: ✅ Returns NEW access_token (valid for another 30 min)     │&lt;br&gt;
│                                                                      │&lt;br&gt;
├──────────────────────────────────────────────────────────────────────┤&lt;br&gt;
│                                                                      │&lt;br&gt;
│   REFRESH TOKEN EXPIRES (after 7 days)                               │&lt;br&gt;
│   ─────────────────────────────────────                              │&lt;br&gt;
│   User must LOGIN AGAIN with email + password                        │&lt;br&gt;
│                                                                      │&lt;br&gt;
└──────────────────────────────────────────────────────────────────────┘&lt;/p&gt;

&lt;h1&gt;
  
  
  3. Grant Token (OAuth2 Concept)
&lt;/h1&gt;

&lt;p&gt;What it is: Part of the OAuth2 "Authorization Code Flow" - used when logging in via Google, GitHub, etc.&lt;/p&gt;

&lt;p&gt;You probably DON'T need this unless you're implementing "Login with Google".&lt;/p&gt;

&lt;h2&gt;
  
  
  Flow:
&lt;/h2&gt;

&lt;p&gt;User clicks "Login with Google"&lt;br&gt;
     ↓&lt;br&gt;
Google shows consent page&lt;br&gt;
     ↓&lt;br&gt;
User approves&lt;br&gt;
     ↓&lt;br&gt;
Google redirects back with a "grant code"&lt;br&gt;
     ↓&lt;br&gt;
Your server exchanges grant code for access_token&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>ai</category>
      <category>programming</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Shadowing in JavaScript</title>
      <dc:creator>Alim Mohammad</dc:creator>
      <pubDate>Wed, 28 Aug 2024 06:10:02 +0000</pubDate>
      <link>https://forem.com/alimalim77/shadowing-in-javascript-12ci</link>
      <guid>https://forem.com/alimalim77/shadowing-in-javascript-12ci</guid>
      <description>&lt;h2&gt;
  
  
  Overview
&lt;/h2&gt;

&lt;p&gt;Shadowing in a special concept in JavaScript that makes the methods belonging to the parent class redefinable in the child class. &lt;/p&gt;

&lt;p&gt;Let us go with two of the darling games of 21st century which are pretty easy to guess, GTA and Red Dead Redemption, unless you are not a fan of open world bangers. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgqwlv51o74e33hr1xm75.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgqwlv51o74e33hr1xm75.gif" alt="Image description" width="498" height="280"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Back to our topic, I will give GTA the role of Parent Class and RDR takes the Child Class spot. &lt;/p&gt;

&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class GTA {
  constructor() {
    this.openWorld = {};
  }

  addFeature(feature, value) {
    this.openWorld[feature] = value;
    return this.openWorld[feature];
  }
}

class RDR extends GTA {
  addFeature(feature) {
    super.addFeature(feature, true);  // Calls the parent class' method and adds the feature
    return true;
  }
}

var role = new RDR();
console.log(role.addFeature('ROLE_PLAYER'));  // This will return true
console.log(role.openWorld);  // This will now have 'ROLE_PLAYER' added to it with value true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Explanation:
&lt;/h2&gt;

&lt;p&gt;super.addFeature(feature, true) calls the addFeature method in the GTA class, adding the feature to the openWorld object.&lt;/p&gt;

&lt;p&gt;The addFeature method in RDR returns true, but it also ensures that ROLE_PLAYER is added to the openWorld object.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1pil76aec3n6dbrlyz3w.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1pil76aec3n6dbrlyz3w.gif" alt="Image description" width="498" height="426"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Closing Note
&lt;/h2&gt;

&lt;p&gt;Looks like ROLE_PLAYER just rode into the wild open world with a value of true. Hope they're ready for the bugs they'll encounter—it's an open-world game, after all!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>programming</category>
      <category>webdev</category>
      <category>javascriptlibraries</category>
    </item>
    <item>
      <title>Why you should use Winston for Logging in JS</title>
      <dc:creator>Alim Mohammad</dc:creator>
      <pubDate>Wed, 05 Jun 2024 05:17:26 +0000</pubDate>
      <link>https://forem.com/alimalim77/why-you-should-use-winston-for-logging-in-js-d76</link>
      <guid>https://forem.com/alimalim77/why-you-should-use-winston-for-logging-in-js-d76</guid>
      <description>&lt;h1&gt;
  
  
  Logging with Winston in JS
&lt;/h1&gt;

&lt;p&gt;Winston JS is a popular open-sourced Javascript logging library used to write logs in code with support extending upto multiple transport. A transport helps the log to be present at multiple levels, be it storage at database level but logs on the console.&lt;/p&gt;

&lt;p&gt;The transports can be either console, database,  files or remote servers making it highly flexible to get logs as per the requirements. The core transports that are part of Winston are Console, File and HTTP while there is option to write logs in third-party transports like MongoDb, CouchDb  and Redis.  The additional transports are written by the members of Winston Community.&lt;/p&gt;

&lt;p&gt;Moreover, there are different levels of a logger, set up in order of their priority in ascending order, specified by proposed standard of RFC 5424 in 2009.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://excalidraw.com/#json=ng5wxDOvU6v9HGlyYSjrq,yjd2OOWba2tFrzQh-lZtDQ"&gt;Pictorial Representation of Levels &lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting Up Winston on Machine
&lt;/h2&gt;

&lt;p&gt;Winston is available on npm to download and it is available to use on-the-go for those are looking for logging solution in their project.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm i winston
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Upon successful installation of winston, we can proceed further with importing the library in our project to use it when required. It will be imported and automatically an object will be created that will come into use to access methods and attributes which are part of the object.&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;winston&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;winston&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;h2&gt;
  
  
  Creating First Logger
&lt;/h2&gt;

&lt;p&gt;Once we are set up with installation and import part of Winston, we can proceed with creating our logger. We have a function at our disposal that is assist in creating a logger with all the necessary properties feeded in the passed object.&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;logger&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;winston&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createLogger&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;transports&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;winston&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;transports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;winston&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;transports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;MongoDB&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
        &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;db&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="s2"&gt;mongodb://localhost/user&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As mentioned in the above code, logger is created with set of transports given in an array, however in program, transports can be added, removed or clear as per developers requirement.&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;file&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;winston&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;transports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;File&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;combined.log&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="nx"&gt;logger&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;clear&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;          &lt;span class="c1"&gt;// Remove all transports&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;file&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;     &lt;span class="c1"&gt;// Add file transport&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Implementing Winston for Logging in a File
&lt;/h2&gt;

&lt;p&gt;To obtain error logs in a file transport, we would be taking example of a full-fledged backend application based on Route-Controller-Service-Model Architecture. &lt;/p&gt;

&lt;p&gt;Initial step comprises of creating a file transport in the &lt;code&gt;index.js&lt;/code&gt; file.&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="nx"&gt;winston&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;winston&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;transports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;File&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;filename&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;root.log&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;p&gt;Now that we have our transport setup for the file named root.log to get the logging performed. We wireframe the connectivity in routing file named &lt;code&gt;route.js&lt;/code&gt;.&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;express&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;express&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;express&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="nx"&gt;app&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;/&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Logging Error to the File&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;p&gt;Lastly, the invoking of error is performed that appends the error log to the file.&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="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;winston&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&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="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;status&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;500&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Crashed into error&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;h2&gt;
  
  
  Implementing Winston for Logging in a MongoDB Collection
&lt;/h2&gt;

&lt;p&gt;On instances, we come across errors that we fancy storing in our database instead of writing them to out files or console. We can move to store them as a MongoDB document in our collection specified. &lt;/p&gt;

&lt;p&gt;An additional winston-mongodb package is needed to work with the database.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm i winston-mongodb
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Similar to logging in a file, create a MongoDB transport in the &lt;code&gt;index.js&lt;/code&gt; file.&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="nx"&gt;winston&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;winston&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;transports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;MongoDB&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;db&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;mongodb://127.0.0.1/test&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;p&gt;The code for route and error logging can be the same as mentioned in section for logging for file but results can be altered on the basis of level provided and transport method picked.&lt;/p&gt;

&lt;h2&gt;
  
  
  Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Winston is used to log errors.&lt;/li&gt;
&lt;li&gt;Winston offers multiple transport, place where log is stored.&lt;/li&gt;
&lt;li&gt;Winston offers flexibility when it comes to writing logs.&lt;/li&gt;
&lt;li&gt;Core transports that are bundled with Winston are Console, File and Http.&lt;/li&gt;
&lt;li&gt;Third-party transports includes MongoDB, Redis etc.&lt;/li&gt;
&lt;li&gt;Transports can be cleared, added or removed.&lt;/li&gt;
&lt;li&gt;Levels can be set for log o&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Breaking Down Redux</title>
      <dc:creator>Alim Mohammad</dc:creator>
      <pubDate>Thu, 12 Oct 2023 10:20:19 +0000</pubDate>
      <link>https://forem.com/alimalim77/breaking-down-redux-toolkit-1enk</link>
      <guid>https://forem.com/alimalim77/breaking-down-redux-toolkit-1enk</guid>
      <description>&lt;p&gt;Redux might be the hot catchword used with React or in general MERN based applications, highlighted as the goto state management tool. &lt;/p&gt;

&lt;p&gt;Before moving further, it becomes a priority to understand what actually is a state. State can be defined as a simplistic JS Object that holds information accessible to all the components in an application.&lt;/p&gt;

&lt;h4&gt;
  
  
  Example - State
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;state = {&lt;br&gt;
username: '',&lt;br&gt;
password: '',&lt;br&gt;
result: '',&lt;br&gt;
status: 1&lt;br&gt;
}&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Features of Redux
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Transparent:&lt;/strong&gt; Redux is transparent in a sense that all the information the state holds must me explicitly available to other components of the application. In programmatic words, it is indeed 'global', that must make pretty clear top understand the purpose of Redux.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Independent:&lt;/strong&gt; Redux does not require a user interface to rely on thus, giving the developer an independent experience.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Supportability:&lt;/strong&gt; Redux has a toolkit named react-redux that is built on top of both the libraries and provides an abstract layer over redux to make the job easier for developer community.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Easy to learn:&lt;/strong&gt; Being a newbie with a mountain of terminologies can be daunting but with more practice and understandability, redux ( or redux toolkit ) can be learned gradually.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
    </item>
    <item>
      <title>Integrating Payment Gateways in MERN Applications</title>
      <dc:creator>Alim Mohammad</dc:creator>
      <pubDate>Sun, 21 May 2023 21:08:26 +0000</pubDate>
      <link>https://forem.com/alimalim77/integrating-payment-gateways-in-mern-applications-482k</link>
      <guid>https://forem.com/alimalim77/integrating-payment-gateways-in-mern-applications-482k</guid>
      <description>&lt;p&gt;In this article, we will be learning about integrating payment gateways in MERN applications as payment options that need to be available for the sake of e-commerce support.&lt;/p&gt;

&lt;p&gt;There can be suitable options for payments such as Razorpay or Stripe. Let us get started with the tutorial:-&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Working of Payment Gateway&lt;/strong&gt;&lt;br&gt;
Firstly, we understand how the payment mechanism works in MERN Stack along with an illustration. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpnt1z4ke0h3avn8hf3uj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpnt1z4ke0h3avn8hf3uj.png" alt="Image description" width="745" height="501"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When a user clicks on the Buy Option on an E-Commerce website, the product ID is passed to the server, the product price is checked and sent to the Razorpay API and an order ID is generated in the response. &lt;/p&gt;

&lt;p&gt;The order ID is passed for the confirmation of the order. Upon completion of payment, Razorpay generates Payment ID, Order ID, Timestamp and Signature.&lt;/p&gt;

&lt;p&gt;The details generated are verified on our server to make sure the payment is completed successfully.&lt;/p&gt;
&lt;h3&gt;
  
  
  Easy Steps to Integrate Payment Gateway using MERN
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnucizk3sj24y5g6dgjnc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnucizk3sj24y5g6dgjnc.png" alt="Image description" width="744" height="267"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;The first step is to create a Razorpay account where you can sign yourself up or log in to your existing email filling up the necessary details until the Razorpay dashboard pops up on your screen. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Keep in mind that if you are doing it for learning purposes, select Test Mode from Top Right.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Head over to Settings~&amp;gt;API Keys~&amp;gt; Generate Test Keys. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Once the keys are generated, copy and paste them into a blank text/document file and minimize the file.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Open command-&amp;gt; Create folder and cd folder navigate to the folder. Once we are done performing this, we create a folder named ‘server’ by writing ‘mkdir server’ and navigate inside.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkxf9liefcrt1oez2cwe3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkxf9liefcrt1oez2cwe3.png" alt="Image description" width="742" height="386"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Next, to create the node app we fire the command npm init which creates your web app with settings.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Later the npm i express dotenv razorpay cors command is written to install all the dependencies required for integrating the payment gateways app. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now you can open the folder in vscode by writing ‘. code’.&lt;br&gt;
Now we have to create an index file that we will import the necessities and work on routing. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The code given below can help you in integrating payment gateways into your MERN application.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
const express = require("express");
const cors = require("cors");
const dotenv = require("dotenv");
const paymentRoute = require("./routes/payments");
//Initialize App
const app = express();


// Setting up enivronment variables
dotenv.config();

//Middlewares
app.use(express.json());
app.use(cors());

//Routing
app.use("/api/payment/",paymentRoute);

//Listening App
const port = process.env.PORT || 8080;
app.listen(port,()=&amp;gt; console.log(`Listening port ${port}`));

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

&lt;/div&gt;


&lt;p&gt;Now we will be creating a folder named routes in the root directly that comes in handy in importing the payment file. The payment file consists of the two APIs that are required for creating the order and verifying the order. &lt;/p&gt;

&lt;p&gt;The given snippet explains the following:-&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const router = require("express").Router();
const Razorpay = require("razorpay");
const crypto = require("crypto");

//Creating Order
router.post("/orders",async(req,res) =&amp;gt; {
    try {
        const instance = new Razorpay({
            key_id: process.env.KEY_ID,
            key_secret: process.env.KEY_SECRET,
        });

        const options = {
            amount: req.body.amount * 100,
            currency:"INR",
            receipt:crypto.randomBytes(10).toString("hex"),
        }
        instance.orders.create(options,(error,order) =&amp;gt; {
            if(error) {
                console.log(error);
                return res.status(500).json({message:"Something Went Wrong!"});
            }
            res.status(200).json({data:order});
        });

    } catch(error) {
        console.log(error);
        res.status(500).json({message:"Internal Server Error!"});
    }

});

//Verifying the payment
router.post("/verify",async(req,res) =&amp;gt; {
    try {
        const {
            razorpay_orderID,
            razorpay_paymentID,
            razorpay_signature } = req.body;
        const sign = razorpay_orderID + "|" + razorpay_paymentID;
        const resultSign = crypto
        .createHmac("sha256",process.env.KEY_SECRET)
        .update(sign.toString())
        .digest("hex");

        if (razorpay_signature == resultSign){
            return res.status(200).json({message:"Payment verified successfully"});
        }

    } catch(error) {
        console.log(error);
        res.status(500).json({message:"Internal Server Error!"});
    }
});

module.exports = router;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We have successfully completed the backend portion of our app. Now create a react app in our root folder with npx create-react-app payapp  and install axios by npm i axios for calling APIs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Setting up the Front End for our Web App&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Once we are done with the backend portion, we will switch to the creation of the front end which is going to be a sample e-commerce shoe store.&lt;/p&gt;

&lt;p&gt;Open React App in your preferred code editor and paste this checkout page link as a script in index.html -&amp;gt;&lt;a href="https://checkout.razorpay.com/v1/checkout.js" rel="noopener noreferrer"&gt;https://checkout.razorpay.com/v1/checkout.js&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On setting up with our react app, we implement useState in react to create a shoe sample for our payment integration with Razorpay. The code looks something like this for App.js.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import axios from "axios";
import {useState} from "react";
import "./App.css";

function App() {
  const [shoe,setShoe] = useState({
    name: "Training Shoes",
    creator: "Nike",
    img: "https://images.pexels.com/photos/3490360/pexels-photo-3490360.jpeg?auto=compress&amp;amp;cs=tinysrgb&amp;amp;dpr=1&amp;amp;w=500",
    price: 500,
});

const initPay = (data) =&amp;gt; {
  const options = {
    key : "************************",
    amount: data.amount,
    currency: data.currency,
    name: shoe.name,
    description: "Test",
    image:shoe.img,
    order_id: data.id,
    handler: async (response) =&amp;gt; {
      try {
        const verifyURL = "https://localhost:8080/api/payment/verify";
        const {data} = await axios.post(verifyURL,response);
      } catch(error) {
        console.log(error);
      }
    },
    theme: {
      color: "#3399cc",
    },
  };
  const rzp1 = new window.Razorpay(options);
  rzp1.open();
};

const handlePay = async () =&amp;gt; {
  try {
    const orderURL = "https://localhost:8080/api/payment/orders";
    const {data} = await axios.post(orderURL,{amount: shoe.price});
    console.log(data);
    initPay(data.data);
  } catch (error) {
    console.log(error);
  }
};

  return(
  &amp;lt;div className="App"&amp;gt;
    &amp;lt;div className="shoe_container"&amp;gt;
      &amp;lt;img src={shoe.img} alt="shoe_img" className="shoe_img" /&amp;gt;
      &amp;lt;p className="shoe_name"&amp;gt;{shoe.name}&amp;lt;/p&amp;gt;
      &amp;lt;p className="shoe_creator"&amp;gt;By {shoe.creator}&amp;lt;/p&amp;gt;
      &amp;lt;p className="shoe_price"&amp;gt;Price: {shoe.price}&amp;lt;/p&amp;gt;
      &amp;lt;button onClick={handlePay} className="buyBtn"&amp;gt;Buy Shoes&amp;lt;/button&amp;gt;
    &amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;
  );
}

export default App;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On applying styling to the className in App.css, the sample frontend looks something like this with the handlePay async function calling the API and making the integrating payment gateways in MERN application successful.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffepswhedrhc8s14aezsg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffepswhedrhc8s14aezsg.png" alt="Image description" width="304" height="427"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Finally, we go to the terminal in the node project folder and node index.js, in the result of which if we click on buy now, we get an integrated payment gateway somewhat like this.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmy0m6jzh6a6xp2lqigpg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmy0m6jzh6a6xp2lqigpg.png" alt="Image description" width="445" height="711"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>react</category>
      <category>node</category>
    </item>
    <item>
      <title>Testing and Debugging in MERN Applications</title>
      <dc:creator>Alim Mohammad</dc:creator>
      <pubDate>Fri, 12 May 2023 08:04:41 +0000</pubDate>
      <link>https://forem.com/alimalim77/testing-and-debugging-in-mern-applications-1695</link>
      <guid>https://forem.com/alimalim77/testing-and-debugging-in-mern-applications-1695</guid>
      <description>&lt;p&gt;&lt;strong&gt;Testing and Debugging in MERN Applications&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In this article, Testing and Debugging in MERN Applications and the different techniques we can implement them are discussed. During the production of a project in an organization, there are various repetitive phases to ensure it performs efficiently in the absence of any bugs or anomalies. Also, we will discuss what technologies one must have under the sleeves to excel at testing and debugging.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Writing Unit Tests&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You should follow the standard way of writing unit tests for modules and components present in your MERN application. The availability of numerous unit testing frameworks such as Mocha, Jest and Jasmine can be used to write unit tests.&lt;/p&gt;

&lt;p&gt;Let us look at an example where components fetch data from an API, displays it and the unit test code verifies if the correct data is displayed on the user's end. We perform the unit test code below using Jest.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react';
import { render } from '@testing-library/react';
import MyComponent from './MyComponent';

test('renders data correctly', () =&amp;gt; {
  const data = { name: 'John', age: 30 };
  const { getByText } = render(&amp;lt;MyComponent data={data} /&amp;gt;);
  const nameElement = getByText(/John/);
  const ageElement = getByText(/30/);
  expect(nameElement).toBeInTheDocument();
  expect(ageElement).toBeInTheDocument();
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Using a Debugger&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When facing issues with code, you can move to debuggers tools like Chrome DevTools, NodeJS Debugger or VSCode debugger that will help you know the issues in your code. Explore features like Browser Inspect, setting up breakpoints or examining the variables to utilise the debugging tools well.&lt;/p&gt;

&lt;p&gt;Given below is the request timeout issue we have with our API that can be resolved using NodeJS debugger tool.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function getUsers(req, res) {
  // This API endpoint returns a list of users
  const users = [/* ... */];
  // Simulate a slow request that times out
  setTimeout(() =&amp;gt; {
    res.json(users);
  }, 10000);
}

// Use the debugger to step through the code
debugger;
app.get('/users', getUsers);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Checking Logs&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Logging is another way to find the issues in your code. Morgan and Winston are some of the important tools that are used to log information in your MERN application.&lt;/p&gt;

&lt;p&gt;Below is one of the examples where we used Winston to log in order to get rid of the glitch where user session is expiring earlier than expected.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const winston = require('winston');

function handleUserSession(req, res) {
  const userId = req.session.userId;
  const sessionExpiresAt = req.session.expiresAt;
  const currentTime = new Date().getTime();
  if (currentTime &amp;gt; sessionExpiresAt) {
    // Session has expired
    winston.error(`User session expired for userId=${userId}`);
    req.session.destroy();
    res.sendStatus(401);
  } else {
    // Session is still valid
    res.sendStatus(200);
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Error handling middleware&lt;/strong&gt;&lt;br&gt;
ExpressJS is a framework that is credible for the usage of error-handling middleware in MERN applications. It catches and handles the exception in code, logs the error and returns the error messages back to the user.&lt;/p&gt;

&lt;p&gt;In the following example, the API returns an error that does not gives a description, here the express middleware can be used as follow:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function handleError(err, req, res, next) {
  // Log the error
  winston.error(`Error: ${err.message}`);
  // Return an error message to the client
  res.status(500).json({ error: 'Internal server error' });
}

app.use(handleError);

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;API Testing&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To test if your API endpoints are working correctly for hassle-free passage of data, tools like Postman and Insomnia can be used. &lt;/p&gt;

&lt;p&gt;For example, you have an API endpoint that fetches some data from the database, here Postman can be used to test the endpoint if it is returning the data correctly.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GET http://localhost:3000/users
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;UI Testing&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To identify the issues persisting in the UI components, testing can be performed with the help of tools like Jest, Enzyme and Cypress. &lt;/p&gt;

&lt;p&gt;In the following example, we used Enzymen UI testing to test the component if it is being rendered properly using the keyword ‘expect’.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react';
import { shallow } from 'enzyme';
import UserList from './UserList';

test('renders user list correctly', () =&amp;gt; {
  const users = [{ name: 'John', age: 30 }, { name: 'Mary', age: 25 }];
  const wrapper = shallow(&amp;lt;UserList users={users} /&amp;gt;);
  expect(wrapper.find('li')).toHaveLength(2);
  expect(wrapper.find('li').at(0).text()).toEqual('John (30 years old)');
  expect(wrapper.find('li').at(1).text()).toEqual('Mary (25 years old)');
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Miscellaneous Uses&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Among the methods discussed for Testing and Debugging of MERN applications, there are certainly more tools that we can follow to do the same such as:- &lt;/p&gt;

&lt;p&gt;Linting can be used to catch and fix syntax errors and related issues. ESLint is one of the primary examples to perform linting.&lt;/p&gt;

&lt;p&gt;Git and similar version control software can be used for branching and tracking the changes to the code. It can be used to move back to the already existing or previous versions of the software.&lt;/p&gt;

&lt;p&gt;Monitoring tools like New Relic, and App Dynamics can be utilized to detect issues or check if the application performance is up to the mark.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In this article, we studied what is testing and debugging in MERN applications and how we can perform them. We also discussed the methods we can perform them such as unit tests, using a debugger or logger or testing our API, UI and similar methods.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>testing</category>
      <category>beginners</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Building RESTful APIs using MERN</title>
      <dc:creator>Alim Mohammad</dc:creator>
      <pubDate>Wed, 10 May 2023 22:42:42 +0000</pubDate>
      <link>https://forem.com/alimalim77/building-restful-apis-using-mern-4pn9</link>
      <guid>https://forem.com/alimalim77/building-restful-apis-using-mern-4pn9</guid>
      <description>&lt;p&gt;&lt;strong&gt;Building RESTful APIs using MERN&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In this article, we will learn how to build RESTful APIs with MERN as API endpoints which is crucial to the functioning of a full-stack application. We will be making them from scratch with an explanation.&lt;/p&gt;

&lt;p&gt;MERN is a popular web development stack used to build websites and webpages comprising services such as Database, Backend and Frontend. The main programming language used in this tech stack is Javascript, which helps in creating applications that are dynamic in nature. &lt;/p&gt;




&lt;p&gt;&lt;strong&gt;How to build RESTful APIs in MERN stack&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Firstly, let us get started with building APIs by installing all the required needs and dependencies that must be present on our system. In our next step,  we have to install the basic dependencies like NodeJS and MongoDB in case they are not already installed in our system else we are good to go. Now that we are done installing dependencies, we must install the popular libraries of express and mongoose using the node package manager. The syntax of both can be defined as we install them each using our terminal.&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Now that the installation is done, we have to let the system know that we want to start creating our project and to fulfill that we write the npm init command to start with our project after which a package.json can be visible in the project folder consisting of all the relevant information about the project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Build the RESTful API&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To create a REST API for our web application,  ExpressJS framework is used. The steps to build are:-&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Once we have installed the Express library using the command, &lt;code&gt;npm install -g express-generator&lt;/code&gt; globally that will let you create your express project anywhere from our system without any hassle.&lt;/li&gt;
&lt;li&gt;Open the terminal and enter the given command: &lt;code&gt;express myproject&lt;/code&gt; and in case the ‘myproject’ looks odd here with the command understanding, it is important to know that ‘myproject’ can be the desired user-provided name for creating an express project. &lt;/li&gt;
&lt;li&gt;In order to install the necessary dependencies, run the &lt;code&gt;npm install&lt;/code&gt;command to initiate the project. It is required if you are using any added packages such as Mongoose.&lt;/li&gt;
&lt;li&gt;API is defined in this step that indicates how well the data is transferred or received across two or more connected endpoints. Another important feature to look up to is the router object, created for defining the API endpoints. &lt;/li&gt;
&lt;li&gt;A method such as GET, POST, PUT, and USE sets up the middleware to function routes at the application level.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example code for creating a RESTful API:-&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const express =   require('express');
const router = express.Router();
router.get('/users', (req, res) =&amp;gt; {
request for endpoint /users });

router.post('/users', (req, res) =&amp;gt; {
request for endpoint /users });
module.exports = router;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As we discussed earlier Mongoose that it is a library that can be used for data models and schema but like most of the applications does not entirely need this, it completely depends upon the requirement of the user or project manager to include it. When it comes to the need of using MongoDB for our web application, we must create a connection by writing the following command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mongoose.connect('mongodb://localhost/mydatabase')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the above code snippet,  you can be confused about what ‘mydatabase’ means, so it can be assumed as your choice of name for the project.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Authentication and Authorization of the Web Application&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now that we are done creating the web application, we must ensure  the security and integrity of the project.  You need to follow certain steps to ensure the security of the project&lt;/p&gt;

&lt;p&gt;Implementation of  JWT in the respective web application is a way to secure your API and it generates a token that can be put into use to make your API secure. They must be used along with other reliable techniques like cookies, and cross-site request forgery tokens to avoid any threats. &lt;/p&gt;

&lt;p&gt;OAuth is a secure way but relies on third-party services like Google, Apple and Github for your authentication. Performing this technique assigns a token that can be used to access the API.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In this article, we saw how we can set up the dependencies and write RESTful APIs that can be used for the passage of data. We further learnt how to create a REST API in the MERN stack by following an ordered sequence of installing dependencies, creating API endpoints, and setting up authentication using JWT and OAuth.&lt;/p&gt;




</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>node</category>
      <category>api</category>
    </item>
    <item>
      <title>Freecodecamp Markdown</title>
      <dc:creator>Alim Mohammad</dc:creator>
      <pubDate>Sun, 02 Apr 2023 12:36:27 +0000</pubDate>
      <link>https://forem.com/alimalim77/freecodecamp-markdown-2mph</link>
      <guid>https://forem.com/alimalim77/freecodecamp-markdown-2mph</guid>
      <description>&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/alimalim77/embed/XWPLpyv?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;In this project, I used codepen to avoid the setup and it was mandatory by freecodecamp to share the link in order to proceed and obtain the front end libraries certification. So lets get started to how we can build this up. &lt;/p&gt;

&lt;p&gt;We start by creating the text area used by the user and the output preview area that will reflect the changes. React was used with respective dependencies installed on settings page except some that I imported. Class component was used to complete the project. &lt;/p&gt;

&lt;p&gt;End result obtained was a visually attractive page that lets you convert text into markdown format. Here is a glimpse of the same:- &lt;/p&gt;

&lt;p&gt;&lt;a href="https://gist.github.com/alimalim77/20a9195d44cf48bf890453e27bc28533"&gt;https://gist.github.com/alimalim77/20a9195d44cf48bf890453e27bc28533&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--AlA3c_5q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zsbef719dytu8rzc0bcz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AlA3c_5q--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zsbef719dytu8rzc0bcz.png" alt="Image description" width="880" height="556"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>codepen</category>
    </item>
    <item>
      <title>Dockerizing Rick and Morty</title>
      <dc:creator>Alim Mohammad</dc:creator>
      <pubDate>Thu, 09 Mar 2023 10:11:10 +0000</pubDate>
      <link>https://forem.com/alimalim77/dockerizing-rick-and-morty-4n94</link>
      <guid>https://forem.com/alimalim77/dockerizing-rick-and-morty-4n94</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;If you're a fan of Rick and Morty, you know that the show deals with some pretty complex concepts. From the multiverse to time-travel, the show often explores some pretty mind-bending ideas. So, it's no surprise that the show's characters might need a little help managing their applications. That's where Docker comes in. In this blog post, we'll explore how Docker can help Rick and Morty simplify their application management.&lt;/p&gt;

&lt;h2&gt;
  
  
  Dockerizing Rick
&lt;/h2&gt;

&lt;p&gt;As a scientist, Rick is always experimenting with new technologies. But sometimes, managing all of those experiments can be a pain. That's where Docker comes in. With Docker, Rick can easily package his experiments into containers and run them anywhere without worrying about compatibility issues. Plus, if something goes wrong, he can easily spin up a new container and start over.&lt;/p&gt;

&lt;h2&gt;
  
  
  Dockerizing Morty
&lt;/h2&gt;

&lt;p&gt;Morty may not be a scientist, but he still has his fair share of applications to manage. From his portal gun to his spaceship, Morty needs a way to keep everything organized. With Docker, Morty can package his applications into containers and run them anywhere with ease. Plus, if he needs to share an application with someone else, he can simply give them the container and know that it will run exactly the same as it does on his machine.&lt;/p&gt;

&lt;h2&gt;
  
  
  Dockerizing the Multiverse
&lt;/h2&gt;

&lt;p&gt;Of course, Rick and Morty don't just deal with applications on their own world. They often travel to other dimensions and universes, each with their own set of technologies and requirements. With Docker, they can easily package their applications into containers that can run on any platform, regardless of the underlying technology. This means they can focus on exploring new worlds without worrying about compatibility issues.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In conclusion, Docker can be a powerful tool for managing applications, even in the wildest of universes. Whether you're a scientist like Rick or an adventurous teenager like Morty, Docker can help simplify your application management and keep your experiments running smoothly. So the next time you're dealing with a complex application, just remember: Dockerize it!&lt;/p&gt;

</description>
      <category>programming</category>
      <category>webdev</category>
      <category>docker</category>
    </item>
    <item>
      <title>Read Constraints the Right Way</title>
      <dc:creator>Alim Mohammad</dc:creator>
      <pubDate>Mon, 31 Oct 2022 08:26:25 +0000</pubDate>
      <link>https://forem.com/alimalim77/read-constraints-the-right-way-3aka</link>
      <guid>https://forem.com/alimalim77/read-constraints-the-right-way-3aka</guid>
      <description>&lt;p&gt;In case you've found it rigid to observe what approach should be the optimal or how to get rid of the annoying time limit error, reading constraints in an important step towards a better approach for problem solving.&lt;/p&gt;

&lt;p&gt;N denotes the number of operations for a range.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;N == 10^5&lt;/strong&gt; - One of the most sought-after constraints in competitive programming and interviews and a boundary line solution to your code in the front of the interviewer. The Time Complexity encompassing under it are O(N), O(N*logN(base2)) and O(N*root(N))&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;N == 10^6&lt;/strong&gt; - The increment of a single power will bar the later one to keep only O(N) and O(N*logN(base2)) enclosed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;N &amp;gt;= 10^9&lt;/strong&gt; - The one supportive complexity at this point is O(logN) with all the other failing at such an insurmountable number of operations. Binary Search much?.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;N == 10^3&lt;/strong&gt; - Apart from O(N), it extends its support to O(N^2) and O(N^2 * logN) solutions. This one is a Breath of fresh air to the beginners.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;N == 10^2&lt;/strong&gt; - The cubic computations are allowed in this special case. Going the brute force might not be a sign of concern in this case. You can opt for O(N), O(N^2), O(N^3) and O(N^3*logN) solutions beforehand. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;N &amp;lt;= 20&lt;/strong&gt; - Exponential complexity is accepted in this constraint with recursion and backtracking the goto approach for solving such problems.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Problem Categorization&lt;/strong&gt;&lt;br&gt;
If at an interview, the constraints can give you the hints on which method would be most suitable for to solve your problem at a single go: -&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
1. 10^2 - Brute force/ Greedy
2. 10^5 - Sorting/ Combinations on Binary Search 
3. 10^8 - HashMap/ Sliding Window/Two Pointer/Stack/Queue
4. 10^10 - Binary Search
5. 4-20 - Recursion/Backtracking
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As obvious, all of them are going to support O(1) in case you are wizard enough at an interview. Hope this helps you with interview. Grind Hard till You Make It.&lt;/p&gt;

</description>
      <category>computerscience</category>
      <category>interview</category>
      <category>programming</category>
      <category>python</category>
    </item>
    <item>
      <title>Leetcode Daily Challenge - Find the Duplicate Number</title>
      <dc:creator>Alim Mohammad</dc:creator>
      <pubDate>Tue, 29 Mar 2022 06:54:38 +0000</pubDate>
      <link>https://forem.com/alimalim77/leetcode-daily-challenge-find-the-duplicate-number-2kei</link>
      <guid>https://forem.com/alimalim77/leetcode-daily-challenge-find-the-duplicate-number-2kei</guid>
      <description>&lt;p&gt;Today's challenge on Leetcode in based on a problem oftenly asked in the interviews. It is a medium level problem and I came up with a couple of solutions for the problem using Sorting approach and Two Pointer Approach.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://leetcode.com/problems/find-the-duplicate-number/"&gt;Find the Duplicate Number&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Intuition
&lt;/h2&gt;

&lt;p&gt;The intuition is pretty straightforward as compared to the actual implementation. However, the time space trade off is the actual crunch in this problem as there can be various ways to solve the the best one is the foremost demand always.&lt;/p&gt;

&lt;h2&gt;
  
  
  Logic: (Approach a)
&lt;/h2&gt;

&lt;p&gt;This approach is the easiest of all as it takes the list and sorts it to check if we can find the element in O(nlogn), for the obvious sorting reasons.&lt;/p&gt;

&lt;p&gt;Algorithm:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. Sort the input list
2. Traverse through list
     if nums[i] == nums[i+1]
       return nums[i]
3. Return -1    
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Logic (Approach b)
&lt;/h2&gt;

&lt;p&gt;The approach can be applied with the use of Floyd Circle algorithm which can be bifurcated into two parts. First where it is checked if there exists a cycle in the list.&lt;/p&gt;

&lt;p&gt;Further, it is made sure with the use of indexing for the element that is repeated. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Qsh3WDNL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/opyfhk0es0giiv1b2bc9.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Qsh3WDNL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/opyfhk0es0giiv1b2bc9.jpg" alt="Floyd Cycle" width="608" height="293"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Code No. 1
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Solution:
    def findDuplicate(self, nums: List[int]) -&amp;gt; int:
        nums.sort()
        for i in range(1, len(nums)):
            if nums[i] == nums[i-1]:
                return nums[i]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Code No. 2
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Solution:
    def findDuplicate(self, nums: List[int]) -&amp;gt; int:
        turtle = 0
        hare = 0
        while True:
            if turtle &amp;gt;= len(nums):
                turtle = 0
            if hare &amp;gt;= len(nums):
                hare = 0
            if nums[turtle] == nums[hare] and turtle != hare:
                return nums[turtle]
            turtle += 1
            hare += 1
        return None

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

&lt;/div&gt;



</description>
      <category>python</category>
      <category>programming</category>
      <category>leetcode</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Leetcode Daily Challenge - Broken Calculator</title>
      <dc:creator>Alim Mohammad</dc:creator>
      <pubDate>Wed, 23 Mar 2022 15:04:33 +0000</pubDate>
      <link>https://forem.com/alimalim77/leetcode-daily-challenge-broken-calculator-11gm</link>
      <guid>https://forem.com/alimalim77/leetcode-daily-challenge-broken-calculator-11gm</guid>
      <description>&lt;p&gt;Today's challenge on Leetcode in based on a Maths/ Greedy Problem. It is a medium level problem and sounds easy but may leave you scratching your head in terms of an optimal solution.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://leetcode.com/problems/broken-calculator/"&gt;991. Broken Calculator&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Problem Statement&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;There is a broken calculator that has the integer startValue on its display initially. In one operation, you can:&lt;br&gt;
multiply the number on display by 2, or&lt;br&gt;
subtract 1 from the number on display.&lt;br&gt;
Given two integers startValue and target, return the minimum number of operations needed to display target on the calculator&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;Input: startValue = 2, target = 3
Output: 2
Explanation: Use double operation and then decrement operation {2 -&amp;gt; 4 -&amp;gt; 3}.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Thought Process:
&lt;/h2&gt;

&lt;p&gt;The immediate thought striking your mind would be to increase the startValue using * operator (in case of a smaller startValue) or decrease it by subtracting to make it equal to target and count the steps we took in our journey.&lt;/p&gt;

&lt;p&gt;It can lead to errors so the desired method is to do the otherwise backward approach. To reduce the target using the exact opposite operators of division and subtraction to count the occurrences of operations. &lt;/p&gt;

&lt;p&gt;In case, target becomes lesser than startValue, we will increment until the startValue and return the difference along with the actual counter. Confused about this step, proceed further and understand.&lt;/p&gt;




&lt;h2&gt;
  
  
  Logic
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;The approach is simple, we declare a counter and run a loop which is terminated once our target value is no more greater than the startValue.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In case our target is odd, we increment the value of target by 1 else we will divide the target value into half.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Eventually, once the loop is terminated, we will return the summation count of times the loop ran and the difference between the startValue and target.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Difference between startValue and target will be decremented on other side of startValue to make it equal to the target along with the counter that ran along the loop.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IUm6BVSO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ep0ihcbfzzvs3usemt7b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IUm6BVSO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ep0ihcbfzzvs3usemt7b.png" alt="Python Solution" width="880" height="536"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;In case, you are looking to learn practice Python from scratch or want to practice DSA then do checkout my YouTube Channel for free lectures and code-along sessions!&lt;br&gt;
&lt;a href="https://www.youtube.com/watch?v=CffZDfq_8Vk&amp;amp;list=PLnGsOhprawFPahp6KOsxY77C6QKddgIkm"&gt;Code Broski: Click here to redirect to Python Fundamentals playlist!&lt;/a&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>python</category>
      <category>data</category>
      <category>leetcode</category>
    </item>
  </channel>
</rss>
