{"action":"created","comment":{"url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/pulls/comments/65813159","id":65813159,"diff_hunk":"@@ -0,0 +1,61 @@\n+'use strict';\n+\n+const Model = require('../model/model');\n+const response = require('../lib/response');\n+const Storage = require('../lib/storage');\n+const newStorage = new Storage(`${__dirname}/../data`);\n+\n+\n+module.exports = function(router){\n+  router.post('/api/model/create', function(req, res){\n+    if (req.body) {\n+      try {\n+        req.body = JSON.parse(req.body);\n+      } catch(err) {\n+        response(400, 'bad request')(res);\n+        return;\n+      }\n+      const model = new Model(req.body.name);\n+      newStorage.setItem('model', model)\n+      .then(function(){\n+        return response(200, model)(res);\n+      }).catch(function(err){\n+        console.error('Error in api/model POST:', err);\n+        response(500, 'server error')(res);\n+      });\n+      return;\n+    }\n+    response(400, 'bad request')(res);\n+\n+  }).get('/api/model/fetch', function(req, res){","path":"lab-matt/route/model-route.js","position":30,"original_position":30,"commit_id":"a8fa9bd98060c00056f8c34c4899aa34e83f4f28","original_commit_id":"a8fa9bd98060c00056f8c34c4899aa34e83f4f28","user":{"login":"sumtype","id":13625286,"avatar_url":"https://avatars.githubusercontent.com/u/13625286?v=3","gravatar_id":"","url":"https://api.github.com/users/sumtype","html_url":"https://github.com/sumtype","followers_url":"https://api.github.com/users/sumtype/followers","following_url":"https://api.github.com/users/sumtype/following{/other_user}","gists_url":"https://api.github.com/users/sumtype/gists{/gist_id}","starred_url":"https://api.github.com/users/sumtype/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sumtype/subscriptions","organizations_url":"https://api.github.com/users/sumtype/orgs","repos_url":"https://api.github.com/users/sumtype/repos","events_url":"https://api.github.com/users/sumtype/events{/privacy}","received_events_url":"https://api.github.com/users/sumtype/received_events","type":"User","site_admin":false},"body":"Your API endpoint should be '/api/model'.","created_at":"2016-06-05T08:10:18Z","updated_at":"2016-06-05T08:10:18Z","html_url":"https://github.com/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/pull/7#discussion_r65813159","pull_request_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/pulls/7","_links":{"self":{"href":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/pulls/comments/65813159"},"html":{"href":"https://github.com/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/pull/7#discussion_r65813159"},"pull_request":{"href":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/pulls/7"}}},"pull_request":{"url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/pulls/7","id":70991197,"html_url":"https://github.com/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/pull/7","diff_url":"https://github.com/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/pull/7.diff","patch_url":"https://github.com/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/pull/7.patch","issue_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/issues/7","number":7,"state":"open","locked":false,"title":"lab-07-08 Matt","user":{"login":"muddybeard210","id":15706672,"avatar_url":"https://avatars.githubusercontent.com/u/15706672?v=3","gravatar_id":"","url":"https://api.github.com/users/muddybeard210","html_url":"https://github.com/muddybeard210","followers_url":"https://api.github.com/users/muddybeard210/followers","following_url":"https://api.github.com/users/muddybeard210/following{/other_user}","gists_url":"https://api.github.com/users/muddybeard210/gists{/gist_id}","starred_url":"https://api.github.com/users/muddybeard210/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/muddybeard210/subscriptions","organizations_url":"https://api.github.com/users/muddybeard210/orgs","repos_url":"https://api.github.com/users/muddybeard210/repos","events_url":"https://api.github.com/users/muddybeard210/events{/privacy}","received_events_url":"https://api.github.com/users/muddybeard210/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-05-22T22:56:56Z","updated_at":"2016-06-05T08:10:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e1c034a40f5628eba9690f789a27dce28673f96c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/pulls/7/commits","review_comments_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/pulls/7/comments","review_comment_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/pulls/comments{/number}","comments_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/issues/7/comments","statuses_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/statuses/a8fa9bd98060c00056f8c34c4899aa34e83f4f28","head":{"label":"muddybeard210:master","ref":"master","sha":"a8fa9bd98060c00056f8c34c4899aa34e83f4f28","user":{"login":"muddybeard210","id":15706672,"avatar_url":"https://avatars.githubusercontent.com/u/15706672?v=3","gravatar_id":"","url":"https://api.github.com/users/muddybeard210","html_url":"https://github.com/muddybeard210","followers_url":"https://api.github.com/users/muddybeard210/followers","following_url":"https://api.github.com/users/muddybeard210/following{/other_user}","gists_url":"https://api.github.com/users/muddybeard210/gists{/gist_id}","starred_url":"https://api.github.com/users/muddybeard210/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/muddybeard210/subscriptions","organizations_url":"https://api.github.com/users/muddybeard210/orgs","repos_url":"https://api.github.com/users/muddybeard210/repos","events_url":"https://api.github.com/users/muddybeard210/events{/privacy}","received_events_url":"https://api.github.com/users/muddybeard210/received_events","type":"User","site_admin":false},"repo":{"id":59162957,"name":"lab-07-08-single-resource-api","full_name":"muddybeard210/lab-07-08-single-resource-api","owner":{"login":"muddybeard210","id":15706672,"avatar_url":"https://avatars.githubusercontent.com/u/15706672?v=3","gravatar_id":"","url":"https://api.github.com/users/muddybeard210","html_url":"https://github.com/muddybeard210","followers_url":"https://api.github.com/users/muddybeard210/followers","following_url":"https://api.github.com/users/muddybeard210/following{/other_user}","gists_url":"https://api.github.com/users/muddybeard210/gists{/gist_id}","starred_url":"https://api.github.com/users/muddybeard210/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/muddybeard210/subscriptions","organizations_url":"https://api.github.com/users/muddybeard210/orgs","repos_url":"https://api.github.com/users/muddybeard210/repos","events_url":"https://api.github.com/users/muddybeard210/events{/privacy}","received_events_url":"https://api.github.com/users/muddybeard210/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/muddybeard210/lab-07-08-single-resource-api","description":"lab-07-single-resource-api","fork":true,"url":"https://api.github.com/repos/muddybeard210/lab-07-08-single-resource-api","forks_url":"https://api.github.com/repos/muddybeard210/lab-07-08-single-resource-api/forks","keys_url":"https://api.github.com/repos/muddybeard210/lab-07-08-single-resource-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/muddybeard210/lab-07-08-single-resource-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/muddybeard210/lab-07-08-single-resource-api/teams","hooks_url":"https://api.github.com/repos/muddybeard210/lab-07-08-single-resource-api/hooks","issue_events_url":"https://api.github.com/repos/muddybeard210/lab-07-08-single-resource-api/issues/events{/number}","events_url":"https://api.github.com/repos/muddybeard210/lab-07-08-single-resource-api/events","assignees_url":"https://api.github.com/repos/muddybeard210/lab-07-08-single-resource-api/assignees{/user}","branches_url":"https://api.github.com/repos/muddybeard210/lab-07-08-single-resource-api/branches{/branch}","tags_url":"https://api.github.com/repos/muddybeard210/lab-07-08-single-resource-api/tags","blobs_url":"https://api.github.com/repos/muddybeard210/lab-07-08-single-resource-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/muddybeard210/lab-07-08-single-resource-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/muddybeard210/lab-07-08-single-resource-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/muddybeard210/lab-07-08-single-resource-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/muddybeard210/lab-07-08-single-resource-api/statuses/{sha}","languages_url":"https://api.github.com/repos/muddybeard210/lab-07-08-single-resource-api/languages","stargazers_url":"https://api.github.com/repos/muddybeard210/lab-07-08-single-resource-api/stargazers","contributors_url":"https://api.github.com/repos/muddybeard210/lab-07-08-single-resource-api/contributors","subscribers_url":"https://api.github.com/repos/muddybeard210/lab-07-08-single-resource-api/subscribers","subscription_url":"https://api.github.com/repos/muddybeard210/lab-07-08-single-resource-api/subscription","commits_url":"https://api.github.com/repos/muddybeard210/lab-07-08-single-resource-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/muddybeard210/lab-07-08-single-resource-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/muddybeard210/lab-07-08-single-resource-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/muddybeard210/lab-07-08-single-resource-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/muddybeard210/lab-07-08-single-resource-api/contents/{+path}","compare_url":"https://api.github.com/repos/muddybeard210/lab-07-08-single-resource-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/muddybeard210/lab-07-08-single-resource-api/merges","archive_url":"https://api.github.com/repos/muddybeard210/lab-07-08-single-resource-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/muddybeard210/lab-07-08-single-resource-api/downloads","issues_url":"https://api.github.com/repos/muddybeard210/lab-07-08-single-resource-api/issues{/number}","pulls_url":"https://api.github.com/repos/muddybeard210/lab-07-08-single-resource-api/pulls{/number}","milestones_url":"https://api.github.com/repos/muddybeard210/lab-07-08-single-resource-api/milestones{/number}","notifications_url":"https://api.github.com/repos/muddybeard210/lab-07-08-single-resource-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/muddybeard210/lab-07-08-single-resource-api/labels{/name}","releases_url":"https://api.github.com/repos/muddybeard210/lab-07-08-single-resource-api/releases{/id}","deployments_url":"https://api.github.com/repos/muddybeard210/lab-07-08-single-resource-api/deployments","created_at":"2016-05-19T01:13:23Z","updated_at":"2016-05-19T02:23:26Z","pushed_at":"2016-05-29T22:22:40Z","git_url":"git://github.com/muddybeard210/lab-07-08-single-resource-api.git","ssh_url":"git@github.com:muddybeard210/lab-07-08-single-resource-api.git","clone_url":"https://github.com/muddybeard210/lab-07-08-single-resource-api.git","svn_url":"https://github.com/muddybeard210/lab-07-08-single-resource-api","homepage":null,"size":17,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"codefellows-seattle-javascript-401n1:master","ref":"master","sha":"a60dcb314165d8e2a0744f3392deaa028f7c7a59","user":{"login":"codefellows-seattle-javascript-401n1","id":18649821,"avatar_url":"https://avatars.githubusercontent.com/u/18649821?v=3","gravatar_id":"","url":"https://api.github.com/users/codefellows-seattle-javascript-401n1","html_url":"https://github.com/codefellows-seattle-javascript-401n1","followers_url":"https://api.github.com/users/codefellows-seattle-javascript-401n1/followers","following_url":"https://api.github.com/users/codefellows-seattle-javascript-401n1/following{/other_user}","gists_url":"https://api.github.com/users/codefellows-seattle-javascript-401n1/gists{/gist_id}","starred_url":"https://api.github.com/users/codefellows-seattle-javascript-401n1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codefellows-seattle-javascript-401n1/subscriptions","organizations_url":"https://api.github.com/users/codefellows-seattle-javascript-401n1/orgs","repos_url":"https://api.github.com/users/codefellows-seattle-javascript-401n1/repos","events_url":"https://api.github.com/users/codefellows-seattle-javascript-401n1/events{/privacy}","received_events_url":"https://api.github.com/users/codefellows-seattle-javascript-401n1/received_events","type":"Organization","site_admin":false},"repo":{"id":59148868,"name":"lab-07-08-single-resource-api","full_name":"codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api","owner":{"login":"codefellows-seattle-javascript-401n1","id":18649821,"avatar_url":"https://avatars.githubusercontent.com/u/18649821?v=3","gravatar_id":"","url":"https://api.github.com/users/codefellows-seattle-javascript-401n1","html_url":"https://github.com/codefellows-seattle-javascript-401n1","followers_url":"https://api.github.com/users/codefellows-seattle-javascript-401n1/followers","following_url":"https://api.github.com/users/codefellows-seattle-javascript-401n1/following{/other_user}","gists_url":"https://api.github.com/users/codefellows-seattle-javascript-401n1/gists{/gist_id}","starred_url":"https://api.github.com/users/codefellows-seattle-javascript-401n1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codefellows-seattle-javascript-401n1/subscriptions","organizations_url":"https://api.github.com/users/codefellows-seattle-javascript-401n1/orgs","repos_url":"https://api.github.com/users/codefellows-seattle-javascript-401n1/repos","events_url":"https://api.github.com/users/codefellows-seattle-javascript-401n1/events{/privacy}","received_events_url":"https://api.github.com/users/codefellows-seattle-javascript-401n1/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api","description":"lab-07-single-resource-api","fork":false,"url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api","forks_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/forks","keys_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/teams","hooks_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/hooks","issue_events_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/issues/events{/number}","events_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/events","assignees_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/assignees{/user}","branches_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/branches{/branch}","tags_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/tags","blobs_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/statuses/{sha}","languages_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/languages","stargazers_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/stargazers","contributors_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/contributors","subscribers_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/subscribers","subscription_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/subscription","commits_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/contents/{+path}","compare_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/merges","archive_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/downloads","issues_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/issues{/number}","pulls_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/pulls{/number}","milestones_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/milestones{/number}","notifications_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/labels{/name}","releases_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/releases{/id}","deployments_url":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/deployments","created_at":"2016-05-18T20:28:11Z","updated_at":"2016-05-18T21:17:01Z","pushed_at":"2016-06-01T21:54:46Z","git_url":"git://github.com/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api.git","ssh_url":"git@github.com:codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api.git","clone_url":"https://github.com/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api.git","svn_url":"https://github.com/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api","homepage":null,"size":30,"stargazers_count":0,"watchers_count":0,"language":"Shell","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":14,"mirror_url":null,"open_issues_count":13,"forks":14,"open_issues":13,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/pulls/7"},"html":{"href":"https://github.com/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/pull/7"},"issue":{"href":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/issues/7"},"comments":{"href":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/issues/7/comments"},"review_comments":{"href":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/pulls/7/comments"},"review_comment":{"href":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/pulls/7/commits"},"statuses":{"href":"https://api.github.com/repos/codefellows-seattle-javascript-401n1/lab-07-08-single-resource-api/statuses/a8fa9bd98060c00056f8c34c4899aa34e83f4f28"}}}}
{"actor":{"display_login":"sumtype"}}