Demystifying Routing: Creating Your Own file-path-based Router
<p>One trend that most JavaScript frameworks are adopting is to provide path-based routing. This means that there is a 1:1 relationship between whatever URL you want to visit and a special folder within your project, containing the route handler functions.</p>
<p>That is to say, if you visit <code>http://<your host>/users/list</code> you’ll have the handler function inside the <code>users/list.js</code> file (or perhaps within the <code>users/list/index.js</code> depending on your preferences).</p>
<p>This is a very nice feature, and one that we take for granted with frameworks like Next, Fresh or others.</p>
<p>That said, I hate taking things for granted, so I’ll try to reverse-engineer how that works in this article.</p>
<p>Let’s take a look at how to implement your own version of path-based routing using Express.</p>
<p><a href="https://blog.bitsrc.io/demystifying-routing-creating-your-own-file-path-based-router-e5f7245a4925">Read More</a></p>