title: Node.js Remove route while server is running
body: <p>Currently I am trying to remove the route of a 
   Node.js server application on runtime.</p>
  
  <pre><code>for (k in self.app.routes.get) {
    if (self.app.routes.get[k].path + "" === route + "") {
      delete self.app.routes.get[k];
      break;
    }
  }
  </code></pre>
  
  <p>After this method is called there is no longer the route in the self.app.routes object. But after I try to access the currently removed route I get the following error:</p>
  
  <blockquote>
    <p>TypeError: Cannot call method 'match' of undefined
        at Router.matchRequest (/var/lib/root/runtime/repo/node_modules/express/lib/router/index.js:205:17)</p>
  </blockquote>
  
  <p>Due to the documentation of express.js this must be the correct way of doing it.</p>
  
  <blockquote>
    <p>The app.routes object houses all of the routes defined mapped by the associated HTTP verb. This object may be used for introspection capabilities, for example Express uses this internally not only for routing but to provide default OPTIONS behaviour unless app.options() is used. Your application or framework may also remove routes by simply by removing them from this object.</p>
  </blockquote>
  
  <p>Does any body know how to correctly remove a route on runtime in Node.js?</p>
  
  <p>Thanks a lot!</p>