{"action":"created","comment":{"url":"https://api.github.com/repos/ealeksandrov/NodeAPI/pulls/comments/22604101","id":22604101,"diff_hunk":"@@ -1,24 +1,80 @@\n-#\tNodeAPI\n+# Node REST API\n \n-##\tSummary\n+REST API for mobile applications using Node.js and Express.js framework with Mongoose.js for working with MongoDB. For access control this project use OAuth 2.0, with the help of OAuth2orize and Passport.js.\n \n-Simple RESTful API implementation on Node.js + MongoDB. Auth based on OAuth2 usrname-password flow. Bearer and refresh tokens support.\n+This is updated code that follows [RESTful API With Node.js + MongoDB](http://aleksandrov.ws/2013/09/12/restful-api-with-nodejs-plus-mongodb) article.\n \n-Tutorials based on this example:\n-* english - [aleksandrov.ws](http://aleksandrov.ws/2013/09/12/restful-api-with-nodejs-plus-mongodb/)\n-* russian - [habrahabr.ru](http://habrahabr.ru/post/193458/)\n+## Running project\n \n-Modules used:\n-* express\n-* mongoose\n-* nconf\n-* winston\n-* Faker\n-* oauth2orize\n-* passport\n+You need to have installed Node.js and MongoDB \n+\n+### Install dependencies \n+\n+To install dependencies enter project folder and run following command:\n+```\n+npm install\n+```\n+\n+### Creating demo data\n+\n+To create demo data in your MongoDB execute ```generateData.js``` file \n+```\n+node generateData.js\n+```\n+\n+### Run server\n+\n+To run server execute:\n+```\n+node bin/www \n+```\n+\n+### Make Requests\n+\n+Creating and refreshing access tokens:\n+```\n+http POST http://localhost:1337/api/oauth/token grant_type=password client_id=android client_secret=SomeRandomCharsAndNumbers username=myapi password=abc1234\n+http POST http://localhost:1337/api/oauth/token grant_type=refresh_token client_id=android client_secret=SomeRandomCharsAndNumbers refresh_token=[TOKEN]\n+```\n+\n+Creating your article data:\n+```\n+http POST http://localhost:1337/api/articles title=NewArticle author='John Doe' description='Lorem ipsum dolar sit amet' images:='[{\"kind\":\"thumbnail\", \"url\":\"http://habrahabr.ru/images/write-topic.png\"}, {\"kind\":\"detail\", \"url\":\"http://habrahabr.ru/images/write-topic.png\"}]' Authorization:'Bearer PUT_YOUR_TOKEN_HERE'\n+```\n+\n+Updating your article data:\n+```\n+http PUT http://localhost:1337/api/articles/YOUR_ARTICLE_ID_HERE title=NewArticleUpdated author='John Doe' description='Lorem ipsum dolar sit amet' images:='[{\"kind\":\"thumbnail\", \"url\":\"http://habrahabr.ru/images/write-topic.png\"}, {\"kind\":\"detail\", \"url\":\"http://habrahabr.ru/images/write-topic.png\"}]' Authorization:'Bearer PUT_YOUR_TOKEN_HERE'\n+```\n+\n+Getting your data \n+```\n+http http://localhost:1337/api/users/info Authorization:'Bearer PUT_YOUR_TOKEN_HERE'\n+http http://localhost:1337/api/articles Authorization:'Bearer PUT_YOUR_TOKEN_HERE'\n+```\n+\n+## Modules used\n+\n+Some of non standard modules used:\n+* [express](https://www.npmjs.com/package/mongoose)\n+* [mongoose](https://www.npmjs.com/package/mongoose)\n+* [nconf](https://www.npmjs.com/package/nconf)\n+* [winston](https://www.npmjs.com/package/winston)\n+* [faker](https://www.npmjs.com/package/faker)\n+* [oauth2orize](https://www.npmjs.com/package/oauth2orize)\n+* [passport](https://www.npmjs.com/package/passport)\n+* [underscore](https://www.npmjs.com/package/underscore)\n+\n+## Tools used\n+\n+[httpie](https://github.com/jkbr/httpie) - command line HTTP client\n \n ## Author\n \n This example was created by Evgeny Aleksandrov ([@EAleksandrov](http://twitter.com/EAleksandrov)).\n+Updated by [Istock Jared](https://github.com/IstockJared) and  [Marko Arsić](http://portfolio.marsic.info/)  \n+\n+## License\n+\n+[MIT](https://github.com/marsicdev/NodeAPI/blob/master/LICENSE)","path":"README.md","position":93,"original_position":93,"commit_id":"11536c2149d741cafc60d64a4c485cc6e1842414","original_commit_id":"11536c2149d741cafc60d64a4c485cc6e1842414","user":{"login":"marsicdev","id":2347279,"avatar_url":"https://avatars.githubusercontent.com/u/2347279?v=3","gravatar_id":"","url":"https://api.github.com/users/marsicdev","html_url":"https://github.com/marsicdev","followers_url":"https://api.github.com/users/marsicdev/followers","following_url":"https://api.github.com/users/marsicdev/following{/other_user}","gists_url":"https://api.github.com/users/marsicdev/gists{/gist_id}","starred_url":"https://api.github.com/users/marsicdev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marsicdev/subscriptions","organizations_url":"https://api.github.com/users/marsicdev/orgs","repos_url":"https://api.github.com/users/marsicdev/repos","events_url":"https://api.github.com/users/marsicdev/events{/privacy}","received_events_url":"https://api.github.com/users/marsicdev/received_events","type":"User","site_admin":false},"body":"Will do :+1: ","created_at":"2015-01-07T18:23:15Z","updated_at":"2015-01-07T18:23:15Z","html_url":"https://github.com/ealeksandrov/NodeAPI/pull/8#discussion_r22604101","pull_request_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/pulls/8","_links":{"self":{"href":"https://api.github.com/repos/ealeksandrov/NodeAPI/pulls/comments/22604101"},"html":{"href":"https://github.com/ealeksandrov/NodeAPI/pull/8#discussion_r22604101"},"pull_request":{"href":"https://api.github.com/repos/ealeksandrov/NodeAPI/pulls/8"}}},"pull_request":{"url":"https://api.github.com/repos/ealeksandrov/NodeAPI/pulls/8","id":26969889,"html_url":"https://github.com/ealeksandrov/NodeAPI/pull/8","diff_url":"https://github.com/ealeksandrov/NodeAPI/pull/8.diff","patch_url":"https://github.com/ealeksandrov/NodeAPI/pull/8.patch","issue_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/issues/8","number":8,"state":"open","locked":false,"title":"Structure update","user":{"login":"marsicdev","id":2347279,"avatar_url":"https://avatars.githubusercontent.com/u/2347279?v=3","gravatar_id":"","url":"https://api.github.com/users/marsicdev","html_url":"https://github.com/marsicdev","followers_url":"https://api.github.com/users/marsicdev/followers","following_url":"https://api.github.com/users/marsicdev/following{/other_user}","gists_url":"https://api.github.com/users/marsicdev/gists{/gist_id}","starred_url":"https://api.github.com/users/marsicdev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marsicdev/subscriptions","organizations_url":"https://api.github.com/users/marsicdev/orgs","repos_url":"https://api.github.com/users/marsicdev/repos","events_url":"https://api.github.com/users/marsicdev/events{/privacy}","received_events_url":"https://api.github.com/users/marsicdev/received_events","type":"User","site_admin":false},"body":"## Improving project structure\r\n* Project structure reorganized in more flexible way following express4 specifications \r\n* Mongoose models moved to separate files\r\n* All configuration set in ```config.json```\r\n* Removed unnecessary files, folders and dependencies\r\n* Logging improved \r\n* Small code refactoring \r\n* ```README.md``` updated with detailed instructions how to run project\r\n \r\nStay tuned more updates and improvements are following... ","created_at":"2015-01-07T16:47:38Z","updated_at":"2015-01-07T18:23:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a77d719cc20fd0a1cda62c514aea97e4c8ba497c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/pulls/8/commits","review_comments_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/pulls/8/comments","review_comment_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/pulls/comments/{number}","comments_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/issues/8/comments","statuses_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/statuses/11536c2149d741cafc60d64a4c485cc6e1842414","head":{"label":"marsicdev:structure-update","ref":"structure-update","sha":"11536c2149d741cafc60d64a4c485cc6e1842414","user":{"login":"marsicdev","id":2347279,"avatar_url":"https://avatars.githubusercontent.com/u/2347279?v=3","gravatar_id":"","url":"https://api.github.com/users/marsicdev","html_url":"https://github.com/marsicdev","followers_url":"https://api.github.com/users/marsicdev/followers","following_url":"https://api.github.com/users/marsicdev/following{/other_user}","gists_url":"https://api.github.com/users/marsicdev/gists{/gist_id}","starred_url":"https://api.github.com/users/marsicdev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marsicdev/subscriptions","organizations_url":"https://api.github.com/users/marsicdev/orgs","repos_url":"https://api.github.com/users/marsicdev/repos","events_url":"https://api.github.com/users/marsicdev/events{/privacy}","received_events_url":"https://api.github.com/users/marsicdev/received_events","type":"User","site_admin":false},"repo":{"id":28864902,"name":"NodeAPI","full_name":"marsicdev/NodeAPI","owner":{"login":"marsicdev","id":2347279,"avatar_url":"https://avatars.githubusercontent.com/u/2347279?v=3","gravatar_id":"","url":"https://api.github.com/users/marsicdev","html_url":"https://github.com/marsicdev","followers_url":"https://api.github.com/users/marsicdev/followers","following_url":"https://api.github.com/users/marsicdev/following{/other_user}","gists_url":"https://api.github.com/users/marsicdev/gists{/gist_id}","starred_url":"https://api.github.com/users/marsicdev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marsicdev/subscriptions","organizations_url":"https://api.github.com/users/marsicdev/orgs","repos_url":"https://api.github.com/users/marsicdev/repos","events_url":"https://api.github.com/users/marsicdev/events{/privacy}","received_events_url":"https://api.github.com/users/marsicdev/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/marsicdev/NodeAPI","description":"Simple RESTful API implementation on Node.js + MongoDB.","fork":true,"url":"https://api.github.com/repos/marsicdev/NodeAPI","forks_url":"https://api.github.com/repos/marsicdev/NodeAPI/forks","keys_url":"https://api.github.com/repos/marsicdev/NodeAPI/keys{/key_id}","collaborators_url":"https://api.github.com/repos/marsicdev/NodeAPI/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/marsicdev/NodeAPI/teams","hooks_url":"https://api.github.com/repos/marsicdev/NodeAPI/hooks","issue_events_url":"https://api.github.com/repos/marsicdev/NodeAPI/issues/events{/number}","events_url":"https://api.github.com/repos/marsicdev/NodeAPI/events","assignees_url":"https://api.github.com/repos/marsicdev/NodeAPI/assignees{/user}","branches_url":"https://api.github.com/repos/marsicdev/NodeAPI/branches{/branch}","tags_url":"https://api.github.com/repos/marsicdev/NodeAPI/tags","blobs_url":"https://api.github.com/repos/marsicdev/NodeAPI/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/marsicdev/NodeAPI/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/marsicdev/NodeAPI/git/refs{/sha}","trees_url":"https://api.github.com/repos/marsicdev/NodeAPI/git/trees{/sha}","statuses_url":"https://api.github.com/repos/marsicdev/NodeAPI/statuses/{sha}","languages_url":"https://api.github.com/repos/marsicdev/NodeAPI/languages","stargazers_url":"https://api.github.com/repos/marsicdev/NodeAPI/stargazers","contributors_url":"https://api.github.com/repos/marsicdev/NodeAPI/contributors","subscribers_url":"https://api.github.com/repos/marsicdev/NodeAPI/subscribers","subscription_url":"https://api.github.com/repos/marsicdev/NodeAPI/subscription","commits_url":"https://api.github.com/repos/marsicdev/NodeAPI/commits{/sha}","git_commits_url":"https://api.github.com/repos/marsicdev/NodeAPI/git/commits{/sha}","comments_url":"https://api.github.com/repos/marsicdev/NodeAPI/comments{/number}","issue_comment_url":"https://api.github.com/repos/marsicdev/NodeAPI/issues/comments/{number}","contents_url":"https://api.github.com/repos/marsicdev/NodeAPI/contents/{+path}","compare_url":"https://api.github.com/repos/marsicdev/NodeAPI/compare/{base}...{head}","merges_url":"https://api.github.com/repos/marsicdev/NodeAPI/merges","archive_url":"https://api.github.com/repos/marsicdev/NodeAPI/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/marsicdev/NodeAPI/downloads","issues_url":"https://api.github.com/repos/marsicdev/NodeAPI/issues{/number}","pulls_url":"https://api.github.com/repos/marsicdev/NodeAPI/pulls{/number}","milestones_url":"https://api.github.com/repos/marsicdev/NodeAPI/milestones{/number}","notifications_url":"https://api.github.com/repos/marsicdev/NodeAPI/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/marsicdev/NodeAPI/labels{/name}","releases_url":"https://api.github.com/repos/marsicdev/NodeAPI/releases{/id}","created_at":"2015-01-06T13:32:58Z","updated_at":"2015-01-07T02:53:47Z","pushed_at":"2015-01-07T02:53:47Z","git_url":"git://github.com/marsicdev/NodeAPI.git","ssh_url":"git@github.com:marsicdev/NodeAPI.git","clone_url":"https://github.com/marsicdev/NodeAPI.git","svn_url":"https://github.com/marsicdev/NodeAPI","homepage":null,"size":107,"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":"ealeksandrov:master","ref":"master","sha":"44f2374f3951396f4f8dfcfaf7cb761cdb5b29cc","user":{"login":"ealeksandrov","id":3132438,"avatar_url":"https://avatars.githubusercontent.com/u/3132438?v=3","gravatar_id":"","url":"https://api.github.com/users/ealeksandrov","html_url":"https://github.com/ealeksandrov","followers_url":"https://api.github.com/users/ealeksandrov/followers","following_url":"https://api.github.com/users/ealeksandrov/following{/other_user}","gists_url":"https://api.github.com/users/ealeksandrov/gists{/gist_id}","starred_url":"https://api.github.com/users/ealeksandrov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ealeksandrov/subscriptions","organizations_url":"https://api.github.com/users/ealeksandrov/orgs","repos_url":"https://api.github.com/users/ealeksandrov/repos","events_url":"https://api.github.com/users/ealeksandrov/events{/privacy}","received_events_url":"https://api.github.com/users/ealeksandrov/received_events","type":"User","site_admin":false},"repo":{"id":12757240,"name":"NodeAPI","full_name":"ealeksandrov/NodeAPI","owner":{"login":"ealeksandrov","id":3132438,"avatar_url":"https://avatars.githubusercontent.com/u/3132438?v=3","gravatar_id":"","url":"https://api.github.com/users/ealeksandrov","html_url":"https://github.com/ealeksandrov","followers_url":"https://api.github.com/users/ealeksandrov/followers","following_url":"https://api.github.com/users/ealeksandrov/following{/other_user}","gists_url":"https://api.github.com/users/ealeksandrov/gists{/gist_id}","starred_url":"https://api.github.com/users/ealeksandrov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ealeksandrov/subscriptions","organizations_url":"https://api.github.com/users/ealeksandrov/orgs","repos_url":"https://api.github.com/users/ealeksandrov/repos","events_url":"https://api.github.com/users/ealeksandrov/events{/privacy}","received_events_url":"https://api.github.com/users/ealeksandrov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ealeksandrov/NodeAPI","description":"Simple RESTful API implementation on Node.js + MongoDB.","fork":false,"url":"https://api.github.com/repos/ealeksandrov/NodeAPI","forks_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/forks","keys_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/teams","hooks_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/hooks","issue_events_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/issues/events{/number}","events_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/events","assignees_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/assignees{/user}","branches_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/branches{/branch}","tags_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/tags","blobs_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/git/refs{/sha}","trees_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/statuses/{sha}","languages_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/languages","stargazers_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/stargazers","contributors_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/contributors","subscribers_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/subscribers","subscription_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/subscription","commits_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/commits{/sha}","git_commits_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/git/commits{/sha}","comments_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/comments{/number}","issue_comment_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/issues/comments/{number}","contents_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/contents/{+path}","compare_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/merges","archive_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/downloads","issues_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/issues{/number}","pulls_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/pulls{/number}","milestones_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/milestones{/number}","notifications_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/labels{/name}","releases_url":"https://api.github.com/repos/ealeksandrov/NodeAPI/releases{/id}","created_at":"2013-09-11T13:39:36Z","updated_at":"2015-01-06T13:32:14Z","pushed_at":"2014-11-11T20:43:34Z","git_url":"git://github.com/ealeksandrov/NodeAPI.git","ssh_url":"git@github.com:ealeksandrov/NodeAPI.git","clone_url":"https://github.com/ealeksandrov/NodeAPI.git","svn_url":"https://github.com/ealeksandrov/NodeAPI","homepage":null,"size":201,"stargazers_count":148,"watchers_count":148,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":53,"mirror_url":null,"open_issues_count":1,"forks":53,"open_issues":1,"watchers":148,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ealeksandrov/NodeAPI/pulls/8"},"html":{"href":"https://github.com/ealeksandrov/NodeAPI/pull/8"},"issue":{"href":"https://api.github.com/repos/ealeksandrov/NodeAPI/issues/8"},"comments":{"href":"https://api.github.com/repos/ealeksandrov/NodeAPI/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/ealeksandrov/NodeAPI/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/ealeksandrov/NodeAPI/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/ealeksandrov/NodeAPI/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/ealeksandrov/NodeAPI/statuses/11536c2149d741cafc60d64a4c485cc6e1842414"}}}}