{"action":"created","comment":{"url":"https://api.github.com/repos/alexdavid/exprestive/pulls/comments/22626030","id":22626030,"diff_hunk":"@@ -80,20 +86,35 @@ class Exprestive\n     @routesMethod @getRoutesHelperMethods()\n \n \n+  # Save a function to @reversePaths to get a url back from a route name\n+  registerReverseRoute: ({routeName, url}) ->\n+    return unless routeName?\n+    @reversePaths[camelCase routeName] = (id) ->\n+      url.replace ':id', id\n+\n+\n   # A helper method for automatically binding restful controllers in a routes file\n   # This is passed as \"resources\" to the routes file function parameter hash\n   resourcesHelperMethod: (controllerName) =>\n-    resourceRoutes = [\n-      [ 'GET',    \"/#{controllerName}\",          'index'   ]\n-      [ 'GET',    \"/#{controllerName}/new\",      'new'     ]\n-      [ 'POST',   \"/#{controllerName}\",          'create'  ]\n-      [ 'GET',    \"/#{controllerName}/:id\",      'show'    ]\n-      [ 'GET',    \"/#{controllerName}/:id/edit\", 'edit'    ]\n-      [ 'PUT',    \"/#{controllerName}/:id\",      'update'  ]\n-      [ 'DELETE', \"/#{controllerName}/:id\",      'destroy' ]\n+    singular = singularize controllerName\n+    plural = pluralize controllerName\n+    for [ httpMethod ,  url                   , controllerAction , routeName          ] in [","path":"src/exprestive.coffee","position":55,"original_position":55,"commit_id":"6d72b686eab358d0703289b8bff221746988e69f","original_commit_id":"6d72b686eab358d0703289b8bff221746988e69f","user":{"login":"kevgo","id":268934,"avatar_url":"https://avatars.githubusercontent.com/u/268934?v=3","gravatar_id":"","url":"https://api.github.com/users/kevgo","html_url":"https://github.com/kevgo","followers_url":"https://api.github.com/users/kevgo/followers","following_url":"https://api.github.com/users/kevgo/following{/other_user}","gists_url":"https://api.github.com/users/kevgo/gists{/gist_id}","starred_url":"https://api.github.com/users/kevgo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kevgo/subscriptions","organizations_url":"https://api.github.com/users/kevgo/orgs","repos_url":"https://api.github.com/users/kevgo/repos","events_url":"https://api.github.com/users/kevgo/events{/privacy}","received_events_url":"https://api.github.com/users/kevgo/received_events","type":"User","site_admin":false},"body":"If you don't pad everything with spaces here, it takes up less horizontal space, and looks more like normal CoffeeScript.","created_at":"2015-01-07T23:43:15Z","updated_at":"2015-01-07T23:43:15Z","html_url":"https://github.com/alexdavid/exprestive/pull/11#discussion_r22626030","pull_request_url":"https://api.github.com/repos/alexdavid/exprestive/pulls/11","_links":{"self":{"href":"https://api.github.com/repos/alexdavid/exprestive/pulls/comments/22626030"},"html":{"href":"https://github.com/alexdavid/exprestive/pull/11#discussion_r22626030"},"pull_request":{"href":"https://api.github.com/repos/alexdavid/exprestive/pulls/11"}}},"pull_request":{"url":"https://api.github.com/repos/alexdavid/exprestive/pulls/11","id":26950435,"html_url":"https://github.com/alexdavid/exprestive/pull/11","diff_url":"https://github.com/alexdavid/exprestive/pull/11.diff","patch_url":"https://github.com/alexdavid/exprestive/pull/11.patch","issue_url":"https://api.github.com/repos/alexdavid/exprestive/issues/11","number":11,"state":"open","locked":false,"title":"Add reverse routing functionality","user":{"login":"alexdavid","id":751581,"avatar_url":"https://avatars.githubusercontent.com/u/751581?v=3","gravatar_id":"","url":"https://api.github.com/users/alexdavid","html_url":"https://github.com/alexdavid","followers_url":"https://api.github.com/users/alexdavid/followers","following_url":"https://api.github.com/users/alexdavid/following{/other_user}","gists_url":"https://api.github.com/users/alexdavid/gists{/gist_id}","starred_url":"https://api.github.com/users/alexdavid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexdavid/subscriptions","organizations_url":"https://api.github.com/users/alexdavid/orgs","repos_url":"https://api.github.com/users/alexdavid/repos","events_url":"https://api.github.com/users/alexdavid/events{/privacy}","received_events_url":"https://api.github.com/users/alexdavid/received_events","type":"User","site_admin":false},"body":"@kevgo initial spike for reverse routing.\r\n\r\nLet me know what you think","created_at":"2015-01-07T10:56:52Z","updated_at":"2015-01-07T23:43:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"981ff44cd9647f4429a8541918f2d83c025e661d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/alexdavid/exprestive/pulls/11/commits","review_comments_url":"https://api.github.com/repos/alexdavid/exprestive/pulls/11/comments","review_comment_url":"https://api.github.com/repos/alexdavid/exprestive/pulls/comments/{number}","comments_url":"https://api.github.com/repos/alexdavid/exprestive/issues/11/comments","statuses_url":"https://api.github.com/repos/alexdavid/exprestive/statuses/6d72b686eab358d0703289b8bff221746988e69f","head":{"label":"alexdavid:ad-reverse-routes","ref":"ad-reverse-routes","sha":"6d72b686eab358d0703289b8bff221746988e69f","user":{"login":"alexdavid","id":751581,"avatar_url":"https://avatars.githubusercontent.com/u/751581?v=3","gravatar_id":"","url":"https://api.github.com/users/alexdavid","html_url":"https://github.com/alexdavid","followers_url":"https://api.github.com/users/alexdavid/followers","following_url":"https://api.github.com/users/alexdavid/following{/other_user}","gists_url":"https://api.github.com/users/alexdavid/gists{/gist_id}","starred_url":"https://api.github.com/users/alexdavid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexdavid/subscriptions","organizations_url":"https://api.github.com/users/alexdavid/orgs","repos_url":"https://api.github.com/users/alexdavid/repos","events_url":"https://api.github.com/users/alexdavid/events{/privacy}","received_events_url":"https://api.github.com/users/alexdavid/received_events","type":"User","site_admin":false},"repo":{"id":28464109,"name":"exprestive","full_name":"alexdavid/exprestive","owner":{"login":"alexdavid","id":751581,"avatar_url":"https://avatars.githubusercontent.com/u/751581?v=3","gravatar_id":"","url":"https://api.github.com/users/alexdavid","html_url":"https://github.com/alexdavid","followers_url":"https://api.github.com/users/alexdavid/followers","following_url":"https://api.github.com/users/alexdavid/following{/other_user}","gists_url":"https://api.github.com/users/alexdavid/gists{/gist_id}","starred_url":"https://api.github.com/users/alexdavid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexdavid/subscriptions","organizations_url":"https://api.github.com/users/alexdavid/orgs","repos_url":"https://api.github.com/users/alexdavid/repos","events_url":"https://api.github.com/users/alexdavid/events{/privacy}","received_events_url":"https://api.github.com/users/alexdavid/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alexdavid/exprestive","description":"A RESTful routing middleware for Express.js","fork":false,"url":"https://api.github.com/repos/alexdavid/exprestive","forks_url":"https://api.github.com/repos/alexdavid/exprestive/forks","keys_url":"https://api.github.com/repos/alexdavid/exprestive/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alexdavid/exprestive/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alexdavid/exprestive/teams","hooks_url":"https://api.github.com/repos/alexdavid/exprestive/hooks","issue_events_url":"https://api.github.com/repos/alexdavid/exprestive/issues/events{/number}","events_url":"https://api.github.com/repos/alexdavid/exprestive/events","assignees_url":"https://api.github.com/repos/alexdavid/exprestive/assignees{/user}","branches_url":"https://api.github.com/repos/alexdavid/exprestive/branches{/branch}","tags_url":"https://api.github.com/repos/alexdavid/exprestive/tags","blobs_url":"https://api.github.com/repos/alexdavid/exprestive/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alexdavid/exprestive/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alexdavid/exprestive/git/refs{/sha}","trees_url":"https://api.github.com/repos/alexdavid/exprestive/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alexdavid/exprestive/statuses/{sha}","languages_url":"https://api.github.com/repos/alexdavid/exprestive/languages","stargazers_url":"https://api.github.com/repos/alexdavid/exprestive/stargazers","contributors_url":"https://api.github.com/repos/alexdavid/exprestive/contributors","subscribers_url":"https://api.github.com/repos/alexdavid/exprestive/subscribers","subscription_url":"https://api.github.com/repos/alexdavid/exprestive/subscription","commits_url":"https://api.github.com/repos/alexdavid/exprestive/commits{/sha}","git_commits_url":"https://api.github.com/repos/alexdavid/exprestive/git/commits{/sha}","comments_url":"https://api.github.com/repos/alexdavid/exprestive/comments{/number}","issue_comment_url":"https://api.github.com/repos/alexdavid/exprestive/issues/comments/{number}","contents_url":"https://api.github.com/repos/alexdavid/exprestive/contents/{+path}","compare_url":"https://api.github.com/repos/alexdavid/exprestive/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alexdavid/exprestive/merges","archive_url":"https://api.github.com/repos/alexdavid/exprestive/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alexdavid/exprestive/downloads","issues_url":"https://api.github.com/repos/alexdavid/exprestive/issues{/number}","pulls_url":"https://api.github.com/repos/alexdavid/exprestive/pulls{/number}","milestones_url":"https://api.github.com/repos/alexdavid/exprestive/milestones{/number}","notifications_url":"https://api.github.com/repos/alexdavid/exprestive/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alexdavid/exprestive/labels{/name}","releases_url":"https://api.github.com/repos/alexdavid/exprestive/releases{/id}","created_at":"2014-12-24T22:58:51Z","updated_at":"2015-01-07T02:17:00Z","pushed_at":"2015-01-07T18:33:27Z","git_url":"git://github.com/alexdavid/exprestive.git","ssh_url":"git@github.com:alexdavid/exprestive.git","clone_url":"https://github.com/alexdavid/exprestive.git","svn_url":"https://github.com/alexdavid/exprestive","homepage":"","size":1784,"stargazers_count":1,"watchers_count":1,"language":"CoffeeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"alexdavid:master","ref":"master","sha":"e6ad9145edb778dbee056513975294c1c3ab17ff","user":{"login":"alexdavid","id":751581,"avatar_url":"https://avatars.githubusercontent.com/u/751581?v=3","gravatar_id":"","url":"https://api.github.com/users/alexdavid","html_url":"https://github.com/alexdavid","followers_url":"https://api.github.com/users/alexdavid/followers","following_url":"https://api.github.com/users/alexdavid/following{/other_user}","gists_url":"https://api.github.com/users/alexdavid/gists{/gist_id}","starred_url":"https://api.github.com/users/alexdavid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexdavid/subscriptions","organizations_url":"https://api.github.com/users/alexdavid/orgs","repos_url":"https://api.github.com/users/alexdavid/repos","events_url":"https://api.github.com/users/alexdavid/events{/privacy}","received_events_url":"https://api.github.com/users/alexdavid/received_events","type":"User","site_admin":false},"repo":{"id":28464109,"name":"exprestive","full_name":"alexdavid/exprestive","owner":{"login":"alexdavid","id":751581,"avatar_url":"https://avatars.githubusercontent.com/u/751581?v=3","gravatar_id":"","url":"https://api.github.com/users/alexdavid","html_url":"https://github.com/alexdavid","followers_url":"https://api.github.com/users/alexdavid/followers","following_url":"https://api.github.com/users/alexdavid/following{/other_user}","gists_url":"https://api.github.com/users/alexdavid/gists{/gist_id}","starred_url":"https://api.github.com/users/alexdavid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexdavid/subscriptions","organizations_url":"https://api.github.com/users/alexdavid/orgs","repos_url":"https://api.github.com/users/alexdavid/repos","events_url":"https://api.github.com/users/alexdavid/events{/privacy}","received_events_url":"https://api.github.com/users/alexdavid/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alexdavid/exprestive","description":"A RESTful routing middleware for Express.js","fork":false,"url":"https://api.github.com/repos/alexdavid/exprestive","forks_url":"https://api.github.com/repos/alexdavid/exprestive/forks","keys_url":"https://api.github.com/repos/alexdavid/exprestive/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alexdavid/exprestive/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alexdavid/exprestive/teams","hooks_url":"https://api.github.com/repos/alexdavid/exprestive/hooks","issue_events_url":"https://api.github.com/repos/alexdavid/exprestive/issues/events{/number}","events_url":"https://api.github.com/repos/alexdavid/exprestive/events","assignees_url":"https://api.github.com/repos/alexdavid/exprestive/assignees{/user}","branches_url":"https://api.github.com/repos/alexdavid/exprestive/branches{/branch}","tags_url":"https://api.github.com/repos/alexdavid/exprestive/tags","blobs_url":"https://api.github.com/repos/alexdavid/exprestive/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alexdavid/exprestive/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alexdavid/exprestive/git/refs{/sha}","trees_url":"https://api.github.com/repos/alexdavid/exprestive/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alexdavid/exprestive/statuses/{sha}","languages_url":"https://api.github.com/repos/alexdavid/exprestive/languages","stargazers_url":"https://api.github.com/repos/alexdavid/exprestive/stargazers","contributors_url":"https://api.github.com/repos/alexdavid/exprestive/contributors","subscribers_url":"https://api.github.com/repos/alexdavid/exprestive/subscribers","subscription_url":"https://api.github.com/repos/alexdavid/exprestive/subscription","commits_url":"https://api.github.com/repos/alexdavid/exprestive/commits{/sha}","git_commits_url":"https://api.github.com/repos/alexdavid/exprestive/git/commits{/sha}","comments_url":"https://api.github.com/repos/alexdavid/exprestive/comments{/number}","issue_comment_url":"https://api.github.com/repos/alexdavid/exprestive/issues/comments/{number}","contents_url":"https://api.github.com/repos/alexdavid/exprestive/contents/{+path}","compare_url":"https://api.github.com/repos/alexdavid/exprestive/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alexdavid/exprestive/merges","archive_url":"https://api.github.com/repos/alexdavid/exprestive/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alexdavid/exprestive/downloads","issues_url":"https://api.github.com/repos/alexdavid/exprestive/issues{/number}","pulls_url":"https://api.github.com/repos/alexdavid/exprestive/pulls{/number}","milestones_url":"https://api.github.com/repos/alexdavid/exprestive/milestones{/number}","notifications_url":"https://api.github.com/repos/alexdavid/exprestive/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alexdavid/exprestive/labels{/name}","releases_url":"https://api.github.com/repos/alexdavid/exprestive/releases{/id}","created_at":"2014-12-24T22:58:51Z","updated_at":"2015-01-07T02:17:00Z","pushed_at":"2015-01-07T18:33:27Z","git_url":"git://github.com/alexdavid/exprestive.git","ssh_url":"git@github.com:alexdavid/exprestive.git","clone_url":"https://github.com/alexdavid/exprestive.git","svn_url":"https://github.com/alexdavid/exprestive","homepage":"","size":1784,"stargazers_count":1,"watchers_count":1,"language":"CoffeeScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/alexdavid/exprestive/pulls/11"},"html":{"href":"https://github.com/alexdavid/exprestive/pull/11"},"issue":{"href":"https://api.github.com/repos/alexdavid/exprestive/issues/11"},"comments":{"href":"https://api.github.com/repos/alexdavid/exprestive/issues/11/comments"},"review_comments":{"href":"https://api.github.com/repos/alexdavid/exprestive/pulls/11/comments"},"review_comment":{"href":"https://api.github.com/repos/alexdavid/exprestive/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/alexdavid/exprestive/pulls/11/commits"},"statuses":{"href":"https://api.github.com/repos/alexdavid/exprestive/statuses/6d72b686eab358d0703289b8bff221746988e69f"}}}}