{"action":"created","comment":{"url":"https://api.github.com/repos/VladSergatyi/origin/pulls/comments/205256656","pull_request_review_id":140492908,"id":205256656,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNTI1NjY1Ng==","diff_hunk":"@@ -1,17 +1,51 @@\n // ізбавитись від app,db , заюзать http://expressjs.com/ru/4x/api.html#router\n 'use strict';\n-const user = require('./../../config/mongoose');\n-const Validator = require('./../libs/Validator');\n \n+const Validator = require('./../libs/Validator');\n+const mongoose = require('./../../config/mongoose');\n module.exports = app => {\n+\n+  let note = mongoose.note;\n+  let user = mongoose.user;\n+\n   const objectDataPage = {\n     title: '',\n     errors: []\n   };\n+\n+  app.get('/listNote', (req, res) => {\n+    note.find().exec((err, result) => {\n+      res.json(result);\n+    })\n+\n+  });\n+  app.get('/createNote', (req, res) => {\n+    res.render('pages/create', objectDataPage);\n+  });\n+  app.post('/createNote', (req, res) => {\n+    if (req.session.user != undefined) {\n+    let newNote = new note({\n+      title: req.body.title,\n+      content: req.body.content\n+    });\n+    newNote.save((err) => {\n+      note.find().exec((err, result) => {\n+        res.json(result);\n+      })\n+    })\n+  }\n+  else {\n+    objectDataPage.title = 'Log in';\n+    objectDataPage.errors = 'Что бы создать заметку нужно авторизоваться.';\n+    res.render('pages/login', objectDataPage);\n+  }\n+  });\n   // LOGIN Block\n   app.get('/login', (req, res) => {\n     res.render('pages/login', {title:\"Log In\", errors:[]});\n+    console.log(req.session.user);","path":"app/routes/note_routes.js","position":48,"original_position":48,"commit_id":"fbbf9d0eb36365e6c7a4345fca9fc4cc6182e210","original_commit_id":"fbbf9d0eb36365e6c7a4345fca9fc4cc6182e210","user":{"login":"mazahell","id":5244650,"node_id":"MDQ6VXNlcjUyNDQ2NTA=","avatar_url":"https://avatars3.githubusercontent.com/u/5244650?v=4","gravatar_id":"","url":"https://api.github.com/users/mazahell","html_url":"https://github.com/mazahell","followers_url":"https://api.github.com/users/mazahell/followers","following_url":"https://api.github.com/users/mazahell/following{/other_user}","gists_url":"https://api.github.com/users/mazahell/gists{/gist_id}","starred_url":"https://api.github.com/users/mazahell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mazahell/subscriptions","organizations_url":"https://api.github.com/users/mazahell/orgs","repos_url":"https://api.github.com/users/mazahell/repos","events_url":"https://api.github.com/users/mazahell/events{/privacy}","received_events_url":"https://api.github.com/users/mazahell/received_events","type":"User","site_admin":false},"body":"консоль лог - погана ідея, для цього існують логери спеціальні, winston наприклад","created_at":"2018-07-25T20:46:10Z","updated_at":"2018-07-25T20:46:11Z","html_url":"https://github.com/VladSergatyi/origin/pull/11#discussion_r205256656","pull_request_url":"https://api.github.com/repos/VladSergatyi/origin/pulls/11","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/VladSergatyi/origin/pulls/comments/205256656"},"html":{"href":"https://github.com/VladSergatyi/origin/pull/11#discussion_r205256656"},"pull_request":{"href":"https://api.github.com/repos/VladSergatyi/origin/pulls/11"}}},"pull_request":{"url":"https://api.github.com/repos/VladSergatyi/origin/pulls/11","id":203759833,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAzNzU5ODMz","html_url":"https://github.com/VladSergatyi/origin/pull/11","diff_url":"https://github.com/VladSergatyi/origin/pull/11.diff","patch_url":"https://github.com/VladSergatyi/origin/pull/11.patch","issue_url":"https://api.github.com/repos/VladSergatyi/origin/issues/11","number":11,"state":"open","locked":false,"title":"Asd","user":{"login":"VladSergatyi","id":40866312,"node_id":"MDQ6VXNlcjQwODY2MzEy","avatar_url":"https://avatars2.githubusercontent.com/u/40866312?v=4","gravatar_id":"","url":"https://api.github.com/users/VladSergatyi","html_url":"https://github.com/VladSergatyi","followers_url":"https://api.github.com/users/VladSergatyi/followers","following_url":"https://api.github.com/users/VladSergatyi/following{/other_user}","gists_url":"https://api.github.com/users/VladSergatyi/gists{/gist_id}","starred_url":"https://api.github.com/users/VladSergatyi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VladSergatyi/subscriptions","organizations_url":"https://api.github.com/users/VladSergatyi/orgs","repos_url":"https://api.github.com/users/VladSergatyi/repos","events_url":"https://api.github.com/users/VladSergatyi/events{/privacy}","received_events_url":"https://api.github.com/users/VladSergatyi/received_events","type":"User","site_admin":false},"body":"3Version","created_at":"2018-07-25T08:31:43Z","updated_at":"2018-07-25T20:46:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7af12f2d6c2974b54f4f535681ebfdbee675dd3d","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/VladSergatyi/origin/pulls/11/commits","review_comments_url":"https://api.github.com/repos/VladSergatyi/origin/pulls/11/comments","review_comment_url":"https://api.github.com/repos/VladSergatyi/origin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/VladSergatyi/origin/issues/11/comments","statuses_url":"https://api.github.com/repos/VladSergatyi/origin/statuses/fbbf9d0eb36365e6c7a4345fca9fc4cc6182e210","head":{"label":"VladSergatyi:asd","ref":"asd","sha":"fbbf9d0eb36365e6c7a4345fca9fc4cc6182e210","user":{"login":"VladSergatyi","id":40866312,"node_id":"MDQ6VXNlcjQwODY2MzEy","avatar_url":"https://avatars2.githubusercontent.com/u/40866312?v=4","gravatar_id":"","url":"https://api.github.com/users/VladSergatyi","html_url":"https://github.com/VladSergatyi","followers_url":"https://api.github.com/users/VladSergatyi/followers","following_url":"https://api.github.com/users/VladSergatyi/following{/other_user}","gists_url":"https://api.github.com/users/VladSergatyi/gists{/gist_id}","starred_url":"https://api.github.com/users/VladSergatyi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VladSergatyi/subscriptions","organizations_url":"https://api.github.com/users/VladSergatyi/orgs","repos_url":"https://api.github.com/users/VladSergatyi/repos","events_url":"https://api.github.com/users/VladSergatyi/events{/privacy}","received_events_url":"https://api.github.com/users/VladSergatyi/received_events","type":"User","site_admin":false},"repo":{"id":140320469,"node_id":"MDEwOlJlcG9zaXRvcnkxNDAzMjA0Njk=","name":"origin","full_name":"VladSergatyi/origin","owner":{"login":"VladSergatyi","id":40866312,"node_id":"MDQ6VXNlcjQwODY2MzEy","avatar_url":"https://avatars2.githubusercontent.com/u/40866312?v=4","gravatar_id":"","url":"https://api.github.com/users/VladSergatyi","html_url":"https://github.com/VladSergatyi","followers_url":"https://api.github.com/users/VladSergatyi/followers","following_url":"https://api.github.com/users/VladSergatyi/following{/other_user}","gists_url":"https://api.github.com/users/VladSergatyi/gists{/gist_id}","starred_url":"https://api.github.com/users/VladSergatyi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VladSergatyi/subscriptions","organizations_url":"https://api.github.com/users/VladSergatyi/orgs","repos_url":"https://api.github.com/users/VladSergatyi/repos","events_url":"https://api.github.com/users/VladSergatyi/events{/privacy}","received_events_url":"https://api.github.com/users/VladSergatyi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/VladSergatyi/origin","description":null,"fork":false,"url":"https://api.github.com/repos/VladSergatyi/origin","forks_url":"https://api.github.com/repos/VladSergatyi/origin/forks","keys_url":"https://api.github.com/repos/VladSergatyi/origin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/VladSergatyi/origin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/VladSergatyi/origin/teams","hooks_url":"https://api.github.com/repos/VladSergatyi/origin/hooks","issue_events_url":"https://api.github.com/repos/VladSergatyi/origin/issues/events{/number}","events_url":"https://api.github.com/repos/VladSergatyi/origin/events","assignees_url":"https://api.github.com/repos/VladSergatyi/origin/assignees{/user}","branches_url":"https://api.github.com/repos/VladSergatyi/origin/branches{/branch}","tags_url":"https://api.github.com/repos/VladSergatyi/origin/tags","blobs_url":"https://api.github.com/repos/VladSergatyi/origin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/VladSergatyi/origin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/VladSergatyi/origin/git/refs{/sha}","trees_url":"https://api.github.com/repos/VladSergatyi/origin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/VladSergatyi/origin/statuses/{sha}","languages_url":"https://api.github.com/repos/VladSergatyi/origin/languages","stargazers_url":"https://api.github.com/repos/VladSergatyi/origin/stargazers","contributors_url":"https://api.github.com/repos/VladSergatyi/origin/contributors","subscribers_url":"https://api.github.com/repos/VladSergatyi/origin/subscribers","subscription_url":"https://api.github.com/repos/VladSergatyi/origin/subscription","commits_url":"https://api.github.com/repos/VladSergatyi/origin/commits{/sha}","git_commits_url":"https://api.github.com/repos/VladSergatyi/origin/git/commits{/sha}","comments_url":"https://api.github.com/repos/VladSergatyi/origin/comments{/number}","issue_comment_url":"https://api.github.com/repos/VladSergatyi/origin/issues/comments{/number}","contents_url":"https://api.github.com/repos/VladSergatyi/origin/contents/{+path}","compare_url":"https://api.github.com/repos/VladSergatyi/origin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/VladSergatyi/origin/merges","archive_url":"https://api.github.com/repos/VladSergatyi/origin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/VladSergatyi/origin/downloads","issues_url":"https://api.github.com/repos/VladSergatyi/origin/issues{/number}","pulls_url":"https://api.github.com/repos/VladSergatyi/origin/pulls{/number}","milestones_url":"https://api.github.com/repos/VladSergatyi/origin/milestones{/number}","notifications_url":"https://api.github.com/repos/VladSergatyi/origin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/VladSergatyi/origin/labels{/name}","releases_url":"https://api.github.com/repos/VladSergatyi/origin/releases{/id}","deployments_url":"https://api.github.com/repos/VladSergatyi/origin/deployments","created_at":"2018-07-09T17:33:39Z","updated_at":"2018-07-22T12:39:59Z","pushed_at":"2018-07-25T08:38:31Z","git_url":"git://github.com/VladSergatyi/origin.git","ssh_url":"git@github.com:VladSergatyi/origin.git","clone_url":"https://github.com/VladSergatyi/origin.git","svn_url":"https://github.com/VladSergatyi/origin","homepage":null,"size":2252,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":2,"license":null,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"VladSergatyi:master","ref":"master","sha":"5567d0359b892c45f3055307fef98c58dca0152a","user":{"login":"VladSergatyi","id":40866312,"node_id":"MDQ6VXNlcjQwODY2MzEy","avatar_url":"https://avatars2.githubusercontent.com/u/40866312?v=4","gravatar_id":"","url":"https://api.github.com/users/VladSergatyi","html_url":"https://github.com/VladSergatyi","followers_url":"https://api.github.com/users/VladSergatyi/followers","following_url":"https://api.github.com/users/VladSergatyi/following{/other_user}","gists_url":"https://api.github.com/users/VladSergatyi/gists{/gist_id}","starred_url":"https://api.github.com/users/VladSergatyi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VladSergatyi/subscriptions","organizations_url":"https://api.github.com/users/VladSergatyi/orgs","repos_url":"https://api.github.com/users/VladSergatyi/repos","events_url":"https://api.github.com/users/VladSergatyi/events{/privacy}","received_events_url":"https://api.github.com/users/VladSergatyi/received_events","type":"User","site_admin":false},"repo":{"id":140320469,"node_id":"MDEwOlJlcG9zaXRvcnkxNDAzMjA0Njk=","name":"origin","full_name":"VladSergatyi/origin","owner":{"login":"VladSergatyi","id":40866312,"node_id":"MDQ6VXNlcjQwODY2MzEy","avatar_url":"https://avatars2.githubusercontent.com/u/40866312?v=4","gravatar_id":"","url":"https://api.github.com/users/VladSergatyi","html_url":"https://github.com/VladSergatyi","followers_url":"https://api.github.com/users/VladSergatyi/followers","following_url":"https://api.github.com/users/VladSergatyi/following{/other_user}","gists_url":"https://api.github.com/users/VladSergatyi/gists{/gist_id}","starred_url":"https://api.github.com/users/VladSergatyi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VladSergatyi/subscriptions","organizations_url":"https://api.github.com/users/VladSergatyi/orgs","repos_url":"https://api.github.com/users/VladSergatyi/repos","events_url":"https://api.github.com/users/VladSergatyi/events{/privacy}","received_events_url":"https://api.github.com/users/VladSergatyi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/VladSergatyi/origin","description":null,"fork":false,"url":"https://api.github.com/repos/VladSergatyi/origin","forks_url":"https://api.github.com/repos/VladSergatyi/origin/forks","keys_url":"https://api.github.com/repos/VladSergatyi/origin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/VladSergatyi/origin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/VladSergatyi/origin/teams","hooks_url":"https://api.github.com/repos/VladSergatyi/origin/hooks","issue_events_url":"https://api.github.com/repos/VladSergatyi/origin/issues/events{/number}","events_url":"https://api.github.com/repos/VladSergatyi/origin/events","assignees_url":"https://api.github.com/repos/VladSergatyi/origin/assignees{/user}","branches_url":"https://api.github.com/repos/VladSergatyi/origin/branches{/branch}","tags_url":"https://api.github.com/repos/VladSergatyi/origin/tags","blobs_url":"https://api.github.com/repos/VladSergatyi/origin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/VladSergatyi/origin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/VladSergatyi/origin/git/refs{/sha}","trees_url":"https://api.github.com/repos/VladSergatyi/origin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/VladSergatyi/origin/statuses/{sha}","languages_url":"https://api.github.com/repos/VladSergatyi/origin/languages","stargazers_url":"https://api.github.com/repos/VladSergatyi/origin/stargazers","contributors_url":"https://api.github.com/repos/VladSergatyi/origin/contributors","subscribers_url":"https://api.github.com/repos/VladSergatyi/origin/subscribers","subscription_url":"https://api.github.com/repos/VladSergatyi/origin/subscription","commits_url":"https://api.github.com/repos/VladSergatyi/origin/commits{/sha}","git_commits_url":"https://api.github.com/repos/VladSergatyi/origin/git/commits{/sha}","comments_url":"https://api.github.com/repos/VladSergatyi/origin/comments{/number}","issue_comment_url":"https://api.github.com/repos/VladSergatyi/origin/issues/comments{/number}","contents_url":"https://api.github.com/repos/VladSergatyi/origin/contents/{+path}","compare_url":"https://api.github.com/repos/VladSergatyi/origin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/VladSergatyi/origin/merges","archive_url":"https://api.github.com/repos/VladSergatyi/origin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/VladSergatyi/origin/downloads","issues_url":"https://api.github.com/repos/VladSergatyi/origin/issues{/number}","pulls_url":"https://api.github.com/repos/VladSergatyi/origin/pulls{/number}","milestones_url":"https://api.github.com/repos/VladSergatyi/origin/milestones{/number}","notifications_url":"https://api.github.com/repos/VladSergatyi/origin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/VladSergatyi/origin/labels{/name}","releases_url":"https://api.github.com/repos/VladSergatyi/origin/releases{/id}","deployments_url":"https://api.github.com/repos/VladSergatyi/origin/deployments","created_at":"2018-07-09T17:33:39Z","updated_at":"2018-07-22T12:39:59Z","pushed_at":"2018-07-25T08:38:31Z","git_url":"git://github.com/VladSergatyi/origin.git","ssh_url":"git@github.com:VladSergatyi/origin.git","clone_url":"https://github.com/VladSergatyi/origin.git","svn_url":"https://github.com/VladSergatyi/origin","homepage":null,"size":2252,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":2,"license":null,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/VladSergatyi/origin/pulls/11"},"html":{"href":"https://github.com/VladSergatyi/origin/pull/11"},"issue":{"href":"https://api.github.com/repos/VladSergatyi/origin/issues/11"},"comments":{"href":"https://api.github.com/repos/VladSergatyi/origin/issues/11/comments"},"review_comments":{"href":"https://api.github.com/repos/VladSergatyi/origin/pulls/11/comments"},"review_comment":{"href":"https://api.github.com/repos/VladSergatyi/origin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/VladSergatyi/origin/pulls/11/commits"},"statuses":{"href":"https://api.github.com/repos/VladSergatyi/origin/statuses/fbbf9d0eb36365e6c7a4345fca9fc4cc6182e210"}},"author_association":"OWNER"}}
{"actor":{"display_login":"mazahell"}}