 express = require 'express'
 fs = require 'fs'
 _ = require 'underscore'
+
+fixPath = (path) ->
+  if path[... 2] == '//'
+    return path[1 ...]
+
+  if path[-1 ...] == '/'
+    return path[... -1]
+
+  return path
 
 formatPathRegex = (regex, base = '') ->
   format = ->

  if regex
    path = base + format regex

    if path
      return path
    else
      return '/'
  else
    return '/'


        if layer.route
          for route_layer in layer.route.stack
            routers.push
              path: fixPath base + layer.route.path
              method: route_layer.method.toUpperCase()
              source: funcSource route_layer.handle
        else if layer.handle.stack
          base_path = base + formatPathRegex(layer.regexp)
          reflectRouter layer.handle, base_path
        else
          middlewares.push
            path: formatPathRegex layer.regexp, base
