<?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: Akhtar Hussain</title>
    <description>The latest articles on DEV Community by Akhtar Hussain (@akhtar02).</description>
    <link>https://dev.to/akhtar02</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%2F746000%2F64cd7b16-2bf5-46e0-8b3a-17f66d4951a8.png</url>
      <title>DEV Community: Akhtar Hussain</title>
      <link>https://dev.to/akhtar02</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/akhtar02"/>
    <language>en</language>
    <item>
      <title>Routing in Express.js</title>
      <dc:creator>Akhtar Hussain</dc:creator>
      <pubDate>Tue, 22 Feb 2022 11:52:35 +0000</pubDate>
      <link>https://dev.to/akhtar02/routing-in-expressjs-40b2</link>
      <guid>https://dev.to/akhtar02/routing-in-expressjs-40b2</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Routing refers to how an application’s endpoints (URIs) respond to client requests. Expressjs official Docs&lt;/p&gt;

&lt;p&gt;You define routing using express app object corresponding HTTP methods POST and GET method.&lt;/p&gt;

&lt;h2&gt;
  
  
  For example
&lt;/h2&gt;

&lt;p&gt;The following code shows an example of a very basic route.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  Route Methods
&lt;/h2&gt;

&lt;p&gt;A route method is derived from one of the HTTP methods and is attached and called on app object, an instance of the express class.&lt;/p&gt;

&lt;h2&gt;
  
  
  GET and POST Methods to the root off the app:
&lt;/h2&gt;

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

&lt;h2&gt;
  
  
  Route Paths
&lt;/h2&gt;

&lt;p&gt;These routes defined in the above code snippet will map to:&lt;br&gt;
&lt;a href="http://localhost:3000/"&gt;http://localhost:3000/&lt;/a&gt; when app is run locally and matching depends on whether client uses POST or GET method and vice versa.&lt;/p&gt;

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

&lt;p&gt;The above route matches to &lt;a href="http://localhost:3000/about"&gt;http://localhost:3000/about&lt;/a&gt; when the app is run locally.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>express</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>Hello world</title>
      <dc:creator>Akhtar Hussain</dc:creator>
      <pubDate>Tue, 22 Feb 2022 07:50:15 +0000</pubDate>
      <link>https://dev.to/akhtar02/hello-world-23ej</link>
      <guid>https://dev.to/akhtar02/hello-world-23ej</guid>
      <description>&lt;p&gt;My First Post &lt;/p&gt;

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