Skip to content

Instantly share code, notes, and snippets.

@lukemorton
Created December 16, 2010 12:41
Show Gist options
  • Save lukemorton/743357 to your computer and use it in GitHub Desktop.
Save lukemorton/743357 to your computer and use it in GitHub Desktop.
routeToRegex = (route) ->
'/' + route.replace('/', '\/') + '/g'
dispatch = (@route, @response) ->
@pattern = routeToRegex route
dispatch '/api/:something', ->
'Hello world'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment