title: Node.js matching the url pattern
body: <p>I need an equivalent of following express.js code in simple node.js that I can use in middleware. I need to place some checks depending on the url and want to do it in a custom middleware.</p>
  
  <pre><code>app.get "/api/users/:username", (req,res) -&gt;
    req.params.username
  </code></pre>
  
  <p>I have the following code so far,</p>
  
  <pre><code>app.use (req,res,next)-&gt;
    if url.parse(req.url,true).pathname is '/api/users/:username' #this wont be true as in the link there will be a actual username not ":username" 
      #my custom check that I want to apply
  </code></pre>