{"action":"created","comment":{"url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/pulls/comments/211907972","pull_request_review_id":148425370,"id":211907972,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxMTkwNzk3Mg==","diff_hunk":"@@ -0,0 +1,35 @@\n+import express from 'express';\n+import { fetchAllQuestionsCtrl } from '../controllers/fetchAllQuestions';\n+import { fetchQuestionCtrl } from '../controllers/fetchQuestion';\n+import { postQuestion } from '../controllers/postQuestion';\n+import { postQuestionValidate } from '../middlewares/postQuestionValidate';\n+import { postAnswer } from '../controllers/postAnswer';\n+import { postAnswerValidate } from '../middlewares/postAnswerValidate';\n+import { urlErrHandler } from '../middlewares/urlErrHandler';\n+\n+const router = express.Router();\n+\n+// GET ALL QUESTIONS\n+router.get('/questions', fetchAllQuestionsCtrl);\n+\n+// GET A QUESTION\n+router.get('/questions/:id([0-9]{1,})', fetchQuestionCtrl);\n+\n+// POST A QUESTION\n+router.post('/questions', postQuestionValidate, postQuestion);\n+\n+// POST AN ANSWER\n+router.post('/questions/:id([0-9]{1,})/answers', postAnswerValidate, postAnswer);\n+\n+\n+// BAD GET A QUESTION REQUEST\n+router.get('/questions/:id([A-z]{1,})', urlErrHandler);","path":"routes/index.js","position":26,"original_position":26,"commit_id":"bace5d77454faea68c97f2e232f37f175c9e5a16","original_commit_id":"bace5d77454faea68c97f2e232f37f175c9e5a16","user":{"login":"Dheavyman","id":28486643,"node_id":"MDQ6VXNlcjI4NDg2NjQz","avatar_url":"https://avatars3.githubusercontent.com/u/28486643?v=4","gravatar_id":"","url":"https://api.github.com/users/Dheavyman","html_url":"https://github.com/Dheavyman","followers_url":"https://api.github.com/users/Dheavyman/followers","following_url":"https://api.github.com/users/Dheavyman/following{/other_user}","gists_url":"https://api.github.com/users/Dheavyman/gists{/gist_id}","starred_url":"https://api.github.com/users/Dheavyman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dheavyman/subscriptions","organizations_url":"https://api.github.com/users/Dheavyman/orgs","repos_url":"https://api.github.com/users/Dheavyman/repos","events_url":"https://api.github.com/users/Dheavyman/events{/privacy}","received_events_url":"https://api.github.com/users/Dheavyman/received_events","type":"User","site_admin":false},"body":"Validation and error handling is a very important part of any application and I can see you are trying to cater for that here but having a new route to handle that is not the best approach. You can make use of middleware on the routes above to check for bad requests and not have a separate bad request route for them. Let me know if you need more clarification on this.","created_at":"2018-08-22T10:40:18Z","updated_at":"2018-08-22T10:40:18Z","html_url":"https://github.com/TheoOkafor/StackOverflow-lite/pull/6#discussion_r211907972","pull_request_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/pulls/6","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/pulls/comments/211907972"},"html":{"href":"https://github.com/TheoOkafor/StackOverflow-lite/pull/6#discussion_r211907972"},"pull_request":{"href":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/pulls/6","id":209993206,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA5OTkzMjA2","html_url":"https://github.com/TheoOkafor/StackOverflow-lite/pull/6","diff_url":"https://github.com/TheoOkafor/StackOverflow-lite/pull/6.diff","patch_url":"https://github.com/TheoOkafor/StackOverflow-lite/pull/6.patch","issue_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/issues/6","number":6,"state":"open","locked":false,"title":"#159912987 Refactor the codebase of the functional APIs","user":{"login":"TheoOkafor","id":31534129,"node_id":"MDQ6VXNlcjMxNTM0MTI5","avatar_url":"https://avatars1.githubusercontent.com/u/31534129?v=4","gravatar_id":"","url":"https://api.github.com/users/TheoOkafor","html_url":"https://github.com/TheoOkafor","followers_url":"https://api.github.com/users/TheoOkafor/followers","following_url":"https://api.github.com/users/TheoOkafor/following{/other_user}","gists_url":"https://api.github.com/users/TheoOkafor/gists{/gist_id}","starred_url":"https://api.github.com/users/TheoOkafor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheoOkafor/subscriptions","organizations_url":"https://api.github.com/users/TheoOkafor/orgs","repos_url":"https://api.github.com/users/TheoOkafor/repos","events_url":"https://api.github.com/users/TheoOkafor/events{/privacy}","received_events_url":"https://api.github.com/users/TheoOkafor/received_events","type":"User","site_admin":false},"body":"#### What does this PR do?\r\n\r\nUser can GET questions, POST Question and Answer\r\n\r\n#### Description of the Task to be completed\r\n\r\nThe tasks to be completed are essentially:\r\n\r\n- User Signin and Sign up\r\n\r\n- Delete Question\r\n\r\n- Put Question and answer\r\n\r\n#### How should this be manually tested?\r\nClone/download repo\r\n\r\nWith NodeJs installed, run `npm start`\r\n\r\nTest the endpoints Using POSTMAN\r\n\r\n#### What are the relevant pivotal tracker stories\r\n\r\n#159912987","created_at":"2018-08-22T00:47:26Z","updated_at":"2018-08-22T10:40:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d3bed2c20d0b135dfcfc830405ef835b37ec4881","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/pulls/6/commits","review_comments_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/pulls/6/comments","review_comment_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/pulls/comments{/number}","comments_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/issues/6/comments","statuses_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/statuses/bace5d77454faea68c97f2e232f37f175c9e5a16","head":{"label":"TheoOkafor:ch-apis-refactoring-159912987","ref":"ch-apis-refactoring-159912987","sha":"bace5d77454faea68c97f2e232f37f175c9e5a16","user":{"login":"TheoOkafor","id":31534129,"node_id":"MDQ6VXNlcjMxNTM0MTI5","avatar_url":"https://avatars1.githubusercontent.com/u/31534129?v=4","gravatar_id":"","url":"https://api.github.com/users/TheoOkafor","html_url":"https://github.com/TheoOkafor","followers_url":"https://api.github.com/users/TheoOkafor/followers","following_url":"https://api.github.com/users/TheoOkafor/following{/other_user}","gists_url":"https://api.github.com/users/TheoOkafor/gists{/gist_id}","starred_url":"https://api.github.com/users/TheoOkafor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheoOkafor/subscriptions","organizations_url":"https://api.github.com/users/TheoOkafor/orgs","repos_url":"https://api.github.com/users/TheoOkafor/repos","events_url":"https://api.github.com/users/TheoOkafor/events{/privacy}","received_events_url":"https://api.github.com/users/TheoOkafor/received_events","type":"User","site_admin":false},"repo":{"id":143769020,"node_id":"MDEwOlJlcG9zaXRvcnkxNDM3NjkwMjA=","name":"StackOverflow-lite","full_name":"TheoOkafor/StackOverflow-lite","owner":{"login":"TheoOkafor","id":31534129,"node_id":"MDQ6VXNlcjMxNTM0MTI5","avatar_url":"https://avatars1.githubusercontent.com/u/31534129?v=4","gravatar_id":"","url":"https://api.github.com/users/TheoOkafor","html_url":"https://github.com/TheoOkafor","followers_url":"https://api.github.com/users/TheoOkafor/followers","following_url":"https://api.github.com/users/TheoOkafor/following{/other_user}","gists_url":"https://api.github.com/users/TheoOkafor/gists{/gist_id}","starred_url":"https://api.github.com/users/TheoOkafor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheoOkafor/subscriptions","organizations_url":"https://api.github.com/users/TheoOkafor/orgs","repos_url":"https://api.github.com/users/TheoOkafor/repos","events_url":"https://api.github.com/users/TheoOkafor/events{/privacy}","received_events_url":"https://api.github.com/users/TheoOkafor/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/TheoOkafor/StackOverflow-lite","description":"StackOverflow-lite is a platform where people can ask questions and provide answers. (Andela Developer Challenge)","fork":false,"url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite","forks_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/forks","keys_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/teams","hooks_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/hooks","issue_events_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/issues/events{/number}","events_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/events","assignees_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/assignees{/user}","branches_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/branches{/branch}","tags_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/tags","blobs_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/git/refs{/sha}","trees_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/statuses/{sha}","languages_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/languages","stargazers_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/stargazers","contributors_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/contributors","subscribers_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/subscribers","subscription_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/subscription","commits_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/commits{/sha}","git_commits_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/git/commits{/sha}","comments_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/comments{/number}","issue_comment_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/issues/comments{/number}","contents_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/contents/{+path}","compare_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/merges","archive_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/downloads","issues_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/issues{/number}","pulls_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/pulls{/number}","milestones_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/milestones{/number}","notifications_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/labels{/name}","releases_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/releases{/id}","deployments_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/deployments","created_at":"2018-08-06T18:44:24Z","updated_at":"2018-08-06T18:44:26Z","pushed_at":"2018-08-22T00:47:27Z","git_url":"git://github.com/TheoOkafor/StackOverflow-lite.git","ssh_url":"git@github.com:TheoOkafor/StackOverflow-lite.git","clone_url":"https://github.com/TheoOkafor/StackOverflow-lite.git","svn_url":"https://github.com/TheoOkafor/StackOverflow-lite","homepage":null,"size":8624,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":4,"license":null,"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"base":{"label":"TheoOkafor:development","ref":"development","sha":"e86e651cf9be4ff9ac13f88017a446f6b9cb0eb4","user":{"login":"TheoOkafor","id":31534129,"node_id":"MDQ6VXNlcjMxNTM0MTI5","avatar_url":"https://avatars1.githubusercontent.com/u/31534129?v=4","gravatar_id":"","url":"https://api.github.com/users/TheoOkafor","html_url":"https://github.com/TheoOkafor","followers_url":"https://api.github.com/users/TheoOkafor/followers","following_url":"https://api.github.com/users/TheoOkafor/following{/other_user}","gists_url":"https://api.github.com/users/TheoOkafor/gists{/gist_id}","starred_url":"https://api.github.com/users/TheoOkafor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheoOkafor/subscriptions","organizations_url":"https://api.github.com/users/TheoOkafor/orgs","repos_url":"https://api.github.com/users/TheoOkafor/repos","events_url":"https://api.github.com/users/TheoOkafor/events{/privacy}","received_events_url":"https://api.github.com/users/TheoOkafor/received_events","type":"User","site_admin":false},"repo":{"id":143769020,"node_id":"MDEwOlJlcG9zaXRvcnkxNDM3NjkwMjA=","name":"StackOverflow-lite","full_name":"TheoOkafor/StackOverflow-lite","owner":{"login":"TheoOkafor","id":31534129,"node_id":"MDQ6VXNlcjMxNTM0MTI5","avatar_url":"https://avatars1.githubusercontent.com/u/31534129?v=4","gravatar_id":"","url":"https://api.github.com/users/TheoOkafor","html_url":"https://github.com/TheoOkafor","followers_url":"https://api.github.com/users/TheoOkafor/followers","following_url":"https://api.github.com/users/TheoOkafor/following{/other_user}","gists_url":"https://api.github.com/users/TheoOkafor/gists{/gist_id}","starred_url":"https://api.github.com/users/TheoOkafor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TheoOkafor/subscriptions","organizations_url":"https://api.github.com/users/TheoOkafor/orgs","repos_url":"https://api.github.com/users/TheoOkafor/repos","events_url":"https://api.github.com/users/TheoOkafor/events{/privacy}","received_events_url":"https://api.github.com/users/TheoOkafor/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/TheoOkafor/StackOverflow-lite","description":"StackOverflow-lite is a platform where people can ask questions and provide answers. (Andela Developer Challenge)","fork":false,"url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite","forks_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/forks","keys_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/teams","hooks_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/hooks","issue_events_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/issues/events{/number}","events_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/events","assignees_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/assignees{/user}","branches_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/branches{/branch}","tags_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/tags","blobs_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/git/refs{/sha}","trees_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/statuses/{sha}","languages_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/languages","stargazers_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/stargazers","contributors_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/contributors","subscribers_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/subscribers","subscription_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/subscription","commits_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/commits{/sha}","git_commits_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/git/commits{/sha}","comments_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/comments{/number}","issue_comment_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/issues/comments{/number}","contents_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/contents/{+path}","compare_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/merges","archive_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/downloads","issues_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/issues{/number}","pulls_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/pulls{/number}","milestones_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/milestones{/number}","notifications_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/labels{/name}","releases_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/releases{/id}","deployments_url":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/deployments","created_at":"2018-08-06T18:44:24Z","updated_at":"2018-08-06T18:44:26Z","pushed_at":"2018-08-22T00:47:27Z","git_url":"git://github.com/TheoOkafor/StackOverflow-lite.git","ssh_url":"git@github.com:TheoOkafor/StackOverflow-lite.git","clone_url":"https://github.com/TheoOkafor/StackOverflow-lite.git","svn_url":"https://github.com/TheoOkafor/StackOverflow-lite","homepage":null,"size":8624,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":4,"license":null,"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/pulls/6"},"html":{"href":"https://github.com/TheoOkafor/StackOverflow-lite/pull/6"},"issue":{"href":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/issues/6"},"comments":{"href":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/TheoOkafor/StackOverflow-lite/statuses/bace5d77454faea68c97f2e232f37f175c9e5a16"}},"author_association":"OWNER"}}
{"actor":{"display_login":"Dheavyman"}}