<?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: Saksham Singh</title>
    <description>The latest articles on DEV Community by Saksham Singh (@saksham294).</description>
    <link>https://dev.to/saksham294</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%2F942447%2F9215ea3e-8b22-4b06-92c7-199c252a8af0.jpeg</url>
      <title>DEV Community: Saksham Singh</title>
      <link>https://dev.to/saksham294</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/saksham294"/>
    <language>en</language>
    <item>
      <title>TrailXpress: My New NPM Package</title>
      <dc:creator>Saksham Singh</dc:creator>
      <pubDate>Fri, 28 Feb 2025 09:26:25 +0000</pubDate>
      <link>https://dev.to/saksham294/trailxpress-my-new-npm-package-833</link>
      <guid>https://dev.to/saksham294/trailxpress-my-new-npm-package-833</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.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%2F5nj9jsn93irwfa3kwtky.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F5nj9jsn93irwfa3kwtky.png" alt="NPM Package" width="800" height="512"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Photo by &lt;a href="https://unsplash.com/@pinjasaur?utm_source=medium&amp;amp;utm_medium=referral" rel="noopener noreferrer"&gt;Paul Esch-Laurent&lt;/a&gt; on &lt;a href="https://unsplash.com/?utm_source=medium&amp;amp;utm_medium=referral" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A while ago, I created Routes-Explorer to help developers extract and visualize Express routes effortlessly. While it served its purpose, I saw opportunities for improvement so I built TrailXpress.&lt;/p&gt;

&lt;p&gt;Routes-Explorer is no longer maintained, and all future development will continue under TrailXpress. If you were using Routes-Explorer, I highly recommend switching over.&lt;/p&gt;

&lt;p&gt;You can install it from here: &lt;a href="https://www.npmjs.com/package/trailxpress" rel="noopener noreferrer"&gt;https://www.npmjs.com/package/trailxpress&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;GitHub link: &lt;a href="https://github.com/Saksham294/trailxpress" rel="noopener noreferrer"&gt;https://github.com/Saksham294/trailxpress&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Usage
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Installation
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;npm install trailxpress&lt;/code&gt;&lt;br&gt;
To use this package, include it in your Node.js project and call the getRoutes function with the path to your Express API file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const { getRoutes } = require('trailxpress');
const apiFilePath = 'path/to/your/api/file.js';
try {
  const routes = getRoutes(apiFilePath);
  console.log('Extracted Routes:', routes);
} catch (error) {
  console.error('Error:', error.message);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Filtering Routes by HTTP Method
&lt;/h3&gt;

&lt;p&gt;You can filter routes based on request types (GET, POST, PUT, DELETE, etc.).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const { getRoutes } = require('trailxpress');
const apiFilePath = 'path/to/your/api/file.js';
const filteredRoutes = getRoutes(apiFilePath, ['GET', 'POST']); // Only fetch GET and POST routes
console.log(filteredRoutes);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Swagger Documentation Generation
&lt;/h3&gt;

&lt;p&gt;TrailXpress can generate Swagger documentation for your 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 { generateSwagger } = require('trailxpress');
const apiFilePath = 'path/to/your/api/file.js';
const routes = getRoutes(apiFilePath);
const swaggerDocs = generateSwagger(routes);
console.log(swaggerDocs);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I have some plans to further improve TrailXpress. If you face any issues, have suggestions or feature request, you can comment below or raise an issue here.&lt;/p&gt;

&lt;p&gt;If you found it useful you can star it too (it means a lot :D )&lt;/p&gt;

&lt;p&gt;I’d love to hear your feedback and learn how TrailXpress can be improved to enhance your developer experience.&lt;/p&gt;

&lt;p&gt;Hope you found it helpful.&lt;/p&gt;

&lt;p&gt;Any suggestions are highly welcome, thank you for reading.&lt;/p&gt;

&lt;p&gt;Feel free to connect with me on other platforms: &lt;a href="https://www.linkedin.com/in/sakshamsingh5001/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; &lt;a href="https://github.com/Saksham294" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; &lt;a href="https://twitter.com/sakshams294" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>express</category>
      <category>npm</category>
    </item>
  </channel>
</rss>
