{"action":"created","comment":{"url":"https://api.github.com/repos/LambdaSchool/Auth/pulls/comments/183097477","pull_request_review_id":114035618,"id":183097477,"diff_hunk":"@@ -1,34 +1,75 @@\n const bodyParser = require('body-parser');\n const express = require('express');\n const session = require('express-session');\n-\n+const bcrypt = require('bcrypt');\n+const User = require('./user');\n const STATUS_USER_ERROR = 422;\n const BCRYPT_COST = 11;\n-\n const server = express();\n-// to enable parsing of json bodies for post requests\n server.use(bodyParser.json());\n-server.use(session({\n-  secret: 'e5SPiqsEtjexkTj3Xqovsjzq8ovjfgVDFMfUzSmJO21dtXs4re'\n-}));\n+server.use(\n+    session({\n+        secret: 'e5SPiqsEtjexkTj3Xqovsjzq8ovjfgVDFMfUzSmJO21dtXs4re'\n+    })\n+);\n \n-/* Sends the given err, a string or an object, to the client. Sets the status\n- * code appropriately. */\n-const sendUserError = (err, res) => {\n-  res.status(STATUS_USER_ERROR);\n-  if (err && err.message) {\n-    res.json({ message: err.message, stack: err.stack });\n-  } else {\n-    res.json({ error: err });\n-  }\n-};\n+server.post('/users', (req, res) => {\n+    const { username, password } = req.body;\n \n-// TODO: implement routes\n+    if (username && password) {\n+        bcrypt.hash(password, BCRYPT_COST, (err, hash) => {\n+            if (err) {\n+                res.status(STATUS_USER_ERROR).json(err);","path":"src/server.js","position":39,"original_position":39,"commit_id":"1083281537ef4ed4c51fbd90efba7b48c6e77664","original_commit_id":"1083281537ef4ed4c51fbd90efba7b48c6e77664","user":{"login":"lefrenk","id":2607929,"avatar_url":"https://avatars1.githubusercontent.com/u/2607929?v=4","gravatar_id":"","url":"https://api.github.com/users/lefrenk","html_url":"https://github.com/lefrenk","followers_url":"https://api.github.com/users/lefrenk/followers","following_url":"https://api.github.com/users/lefrenk/following{/other_user}","gists_url":"https://api.github.com/users/lefrenk/gists{/gist_id}","starred_url":"https://api.github.com/users/lefrenk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lefrenk/subscriptions","organizations_url":"https://api.github.com/users/lefrenk/orgs","repos_url":"https://api.github.com/users/lefrenk/repos","events_url":"https://api.github.com/users/lefrenk/events{/privacy}","received_events_url":"https://api.github.com/users/lefrenk/received_events","type":"User","site_admin":false},"body":"Make _sure_ you `return` in this `if` statement so that the rest of the function stops its execution.","created_at":"2018-04-20T16:01:18Z","updated_at":"2018-04-20T16:01:18Z","html_url":"https://github.com/LambdaSchool/Auth/pull/123#discussion_r183097477","pull_request_url":"https://api.github.com/repos/LambdaSchool/Auth/pulls/123","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/LambdaSchool/Auth/pulls/comments/183097477"},"html":{"href":"https://github.com/LambdaSchool/Auth/pull/123#discussion_r183097477"},"pull_request":{"href":"https://api.github.com/repos/LambdaSchool/Auth/pulls/123"}}},"pull_request":{"url":"https://api.github.com/repos/LambdaSchool/Auth/pulls/123","id":182329574,"html_url":"https://github.com/LambdaSchool/Auth/pull/123","diff_url":"https://github.com/LambdaSchool/Auth/pull/123.diff","patch_url":"https://github.com/LambdaSchool/Auth/pull/123.patch","issue_url":"https://api.github.com/repos/LambdaSchool/Auth/issues/123","number":123,"state":"open","locked":false,"title":"abraham andujo","user":{"login":"foxtara1","id":36176997,"avatar_url":"https://avatars0.githubusercontent.com/u/36176997?v=4","gravatar_id":"","url":"https://api.github.com/users/foxtara1","html_url":"https://github.com/foxtara1","followers_url":"https://api.github.com/users/foxtara1/followers","following_url":"https://api.github.com/users/foxtara1/following{/other_user}","gists_url":"https://api.github.com/users/foxtara1/gists{/gist_id}","starred_url":"https://api.github.com/users/foxtara1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/foxtara1/subscriptions","organizations_url":"https://api.github.com/users/foxtara1/orgs","repos_url":"https://api.github.com/users/foxtara1/repos","events_url":"https://api.github.com/users/foxtara1/events{/privacy}","received_events_url":"https://api.github.com/users/foxtara1/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-04-17T23:18:24Z","updated_at":"2018-04-20T16:01:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"41aef90b68c90cf7a15f43213bf50cd23e7479dc","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/LambdaSchool/Auth/pulls/123/commits","review_comments_url":"https://api.github.com/repos/LambdaSchool/Auth/pulls/123/comments","review_comment_url":"https://api.github.com/repos/LambdaSchool/Auth/pulls/comments{/number}","comments_url":"https://api.github.com/repos/LambdaSchool/Auth/issues/123/comments","statuses_url":"https://api.github.com/repos/LambdaSchool/Auth/statuses/1083281537ef4ed4c51fbd90efba7b48c6e77664","head":{"label":"foxtara1:master","ref":"master","sha":"1083281537ef4ed4c51fbd90efba7b48c6e77664","user":{"login":"foxtara1","id":36176997,"avatar_url":"https://avatars0.githubusercontent.com/u/36176997?v=4","gravatar_id":"","url":"https://api.github.com/users/foxtara1","html_url":"https://github.com/foxtara1","followers_url":"https://api.github.com/users/foxtara1/followers","following_url":"https://api.github.com/users/foxtara1/following{/other_user}","gists_url":"https://api.github.com/users/foxtara1/gists{/gist_id}","starred_url":"https://api.github.com/users/foxtara1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/foxtara1/subscriptions","organizations_url":"https://api.github.com/users/foxtara1/orgs","repos_url":"https://api.github.com/users/foxtara1/repos","events_url":"https://api.github.com/users/foxtara1/events{/privacy}","received_events_url":"https://api.github.com/users/foxtara1/received_events","type":"User","site_admin":false},"repo":{"id":129937330,"name":"Auth","full_name":"foxtara1/Auth","owner":{"login":"foxtara1","id":36176997,"avatar_url":"https://avatars0.githubusercontent.com/u/36176997?v=4","gravatar_id":"","url":"https://api.github.com/users/foxtara1","html_url":"https://github.com/foxtara1","followers_url":"https://api.github.com/users/foxtara1/followers","following_url":"https://api.github.com/users/foxtara1/following{/other_user}","gists_url":"https://api.github.com/users/foxtara1/gists{/gist_id}","starred_url":"https://api.github.com/users/foxtara1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/foxtara1/subscriptions","organizations_url":"https://api.github.com/users/foxtara1/orgs","repos_url":"https://api.github.com/users/foxtara1/repos","events_url":"https://api.github.com/users/foxtara1/events{/privacy}","received_events_url":"https://api.github.com/users/foxtara1/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/foxtara1/Auth","description":null,"fork":true,"url":"https://api.github.com/repos/foxtara1/Auth","forks_url":"https://api.github.com/repos/foxtara1/Auth/forks","keys_url":"https://api.github.com/repos/foxtara1/Auth/keys{/key_id}","collaborators_url":"https://api.github.com/repos/foxtara1/Auth/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/foxtara1/Auth/teams","hooks_url":"https://api.github.com/repos/foxtara1/Auth/hooks","issue_events_url":"https://api.github.com/repos/foxtara1/Auth/issues/events{/number}","events_url":"https://api.github.com/repos/foxtara1/Auth/events","assignees_url":"https://api.github.com/repos/foxtara1/Auth/assignees{/user}","branches_url":"https://api.github.com/repos/foxtara1/Auth/branches{/branch}","tags_url":"https://api.github.com/repos/foxtara1/Auth/tags","blobs_url":"https://api.github.com/repos/foxtara1/Auth/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/foxtara1/Auth/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/foxtara1/Auth/git/refs{/sha}","trees_url":"https://api.github.com/repos/foxtara1/Auth/git/trees{/sha}","statuses_url":"https://api.github.com/repos/foxtara1/Auth/statuses/{sha}","languages_url":"https://api.github.com/repos/foxtara1/Auth/languages","stargazers_url":"https://api.github.com/repos/foxtara1/Auth/stargazers","contributors_url":"https://api.github.com/repos/foxtara1/Auth/contributors","subscribers_url":"https://api.github.com/repos/foxtara1/Auth/subscribers","subscription_url":"https://api.github.com/repos/foxtara1/Auth/subscription","commits_url":"https://api.github.com/repos/foxtara1/Auth/commits{/sha}","git_commits_url":"https://api.github.com/repos/foxtara1/Auth/git/commits{/sha}","comments_url":"https://api.github.com/repos/foxtara1/Auth/comments{/number}","issue_comment_url":"https://api.github.com/repos/foxtara1/Auth/issues/comments{/number}","contents_url":"https://api.github.com/repos/foxtara1/Auth/contents/{+path}","compare_url":"https://api.github.com/repos/foxtara1/Auth/compare/{base}...{head}","merges_url":"https://api.github.com/repos/foxtara1/Auth/merges","archive_url":"https://api.github.com/repos/foxtara1/Auth/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/foxtara1/Auth/downloads","issues_url":"https://api.github.com/repos/foxtara1/Auth/issues{/number}","pulls_url":"https://api.github.com/repos/foxtara1/Auth/pulls{/number}","milestones_url":"https://api.github.com/repos/foxtara1/Auth/milestones{/number}","notifications_url":"https://api.github.com/repos/foxtara1/Auth/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/foxtara1/Auth/labels{/name}","releases_url":"https://api.github.com/repos/foxtara1/Auth/releases{/id}","deployments_url":"https://api.github.com/repos/foxtara1/Auth/deployments","created_at":"2018-04-17T16:53:58Z","updated_at":"2018-04-17T23:13:25Z","pushed_at":"2018-04-17T23:13:23Z","git_url":"git://github.com/foxtara1/Auth.git","ssh_url":"git@github.com:foxtara1/Auth.git","clone_url":"https://github.com/foxtara1/Auth.git","svn_url":"https://github.com/foxtara1/Auth","homepage":null,"size":196,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"LambdaSchool:master","ref":"master","sha":"a54ad91ee3ccb8edbfee89869e5ff65d8b61af33","user":{"login":"LambdaSchool","id":24780114,"avatar_url":"https://avatars1.githubusercontent.com/u/24780114?v=4","gravatar_id":"","url":"https://api.github.com/users/LambdaSchool","html_url":"https://github.com/LambdaSchool","followers_url":"https://api.github.com/users/LambdaSchool/followers","following_url":"https://api.github.com/users/LambdaSchool/following{/other_user}","gists_url":"https://api.github.com/users/LambdaSchool/gists{/gist_id}","starred_url":"https://api.github.com/users/LambdaSchool/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LambdaSchool/subscriptions","organizations_url":"https://api.github.com/users/LambdaSchool/orgs","repos_url":"https://api.github.com/users/LambdaSchool/repos","events_url":"https://api.github.com/users/LambdaSchool/events{/privacy}","received_events_url":"https://api.github.com/users/LambdaSchool/received_events","type":"Organization","site_admin":false},"repo":{"id":101209425,"name":"Auth","full_name":"LambdaSchool/Auth","owner":{"login":"LambdaSchool","id":24780114,"avatar_url":"https://avatars1.githubusercontent.com/u/24780114?v=4","gravatar_id":"","url":"https://api.github.com/users/LambdaSchool","html_url":"https://github.com/LambdaSchool","followers_url":"https://api.github.com/users/LambdaSchool/followers","following_url":"https://api.github.com/users/LambdaSchool/following{/other_user}","gists_url":"https://api.github.com/users/LambdaSchool/gists{/gist_id}","starred_url":"https://api.github.com/users/LambdaSchool/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LambdaSchool/subscriptions","organizations_url":"https://api.github.com/users/LambdaSchool/orgs","repos_url":"https://api.github.com/users/LambdaSchool/repos","events_url":"https://api.github.com/users/LambdaSchool/events{/privacy}","received_events_url":"https://api.github.com/users/LambdaSchool/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/LambdaSchool/Auth","description":null,"fork":false,"url":"https://api.github.com/repos/LambdaSchool/Auth","forks_url":"https://api.github.com/repos/LambdaSchool/Auth/forks","keys_url":"https://api.github.com/repos/LambdaSchool/Auth/keys{/key_id}","collaborators_url":"https://api.github.com/repos/LambdaSchool/Auth/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/LambdaSchool/Auth/teams","hooks_url":"https://api.github.com/repos/LambdaSchool/Auth/hooks","issue_events_url":"https://api.github.com/repos/LambdaSchool/Auth/issues/events{/number}","events_url":"https://api.github.com/repos/LambdaSchool/Auth/events","assignees_url":"https://api.github.com/repos/LambdaSchool/Auth/assignees{/user}","branches_url":"https://api.github.com/repos/LambdaSchool/Auth/branches{/branch}","tags_url":"https://api.github.com/repos/LambdaSchool/Auth/tags","blobs_url":"https://api.github.com/repos/LambdaSchool/Auth/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/LambdaSchool/Auth/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/LambdaSchool/Auth/git/refs{/sha}","trees_url":"https://api.github.com/repos/LambdaSchool/Auth/git/trees{/sha}","statuses_url":"https://api.github.com/repos/LambdaSchool/Auth/statuses/{sha}","languages_url":"https://api.github.com/repos/LambdaSchool/Auth/languages","stargazers_url":"https://api.github.com/repos/LambdaSchool/Auth/stargazers","contributors_url":"https://api.github.com/repos/LambdaSchool/Auth/contributors","subscribers_url":"https://api.github.com/repos/LambdaSchool/Auth/subscribers","subscription_url":"https://api.github.com/repos/LambdaSchool/Auth/subscription","commits_url":"https://api.github.com/repos/LambdaSchool/Auth/commits{/sha}","git_commits_url":"https://api.github.com/repos/LambdaSchool/Auth/git/commits{/sha}","comments_url":"https://api.github.com/repos/LambdaSchool/Auth/comments{/number}","issue_comment_url":"https://api.github.com/repos/LambdaSchool/Auth/issues/comments{/number}","contents_url":"https://api.github.com/repos/LambdaSchool/Auth/contents/{+path}","compare_url":"https://api.github.com/repos/LambdaSchool/Auth/compare/{base}...{head}","merges_url":"https://api.github.com/repos/LambdaSchool/Auth/merges","archive_url":"https://api.github.com/repos/LambdaSchool/Auth/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/LambdaSchool/Auth/downloads","issues_url":"https://api.github.com/repos/LambdaSchool/Auth/issues{/number}","pulls_url":"https://api.github.com/repos/LambdaSchool/Auth/pulls{/number}","milestones_url":"https://api.github.com/repos/LambdaSchool/Auth/milestones{/number}","notifications_url":"https://api.github.com/repos/LambdaSchool/Auth/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/LambdaSchool/Auth/labels{/name}","releases_url":"https://api.github.com/repos/LambdaSchool/Auth/releases{/id}","deployments_url":"https://api.github.com/repos/LambdaSchool/Auth/deployments","created_at":"2017-08-23T17:52:22Z","updated_at":"2018-03-20T18:21:36Z","pushed_at":"2018-04-20T08:02:25Z","git_url":"git://github.com/LambdaSchool/Auth.git","ssh_url":"git@github.com:LambdaSchool/Auth.git","clone_url":"https://github.com/LambdaSchool/Auth.git","svn_url":"https://github.com/LambdaSchool/Auth","homepage":null,"size":194,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":226,"mirror_url":null,"archived":false,"open_issues_count":69,"license":null,"forks":226,"open_issues":69,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/LambdaSchool/Auth/pulls/123"},"html":{"href":"https://github.com/LambdaSchool/Auth/pull/123"},"issue":{"href":"https://api.github.com/repos/LambdaSchool/Auth/issues/123"},"comments":{"href":"https://api.github.com/repos/LambdaSchool/Auth/issues/123/comments"},"review_comments":{"href":"https://api.github.com/repos/LambdaSchool/Auth/pulls/123/comments"},"review_comment":{"href":"https://api.github.com/repos/LambdaSchool/Auth/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/LambdaSchool/Auth/pulls/123/commits"},"statuses":{"href":"https://api.github.com/repos/LambdaSchool/Auth/statuses/1083281537ef4ed4c51fbd90efba7b48c6e77664"}},"author_association":"NONE"}}
{"actor":{"display_login":"lefrenk"}}