{"id":17053465,"url":"https://github.com/ealeksandrov/nodeapi","last_synced_at":"2025-05-15T00:06:49.965Z","repository":{"id":10556475,"uuid":"12757240","full_name":"ealeksandrov/NodeAPI","owner":"ealeksandrov","description":"Simple RESTful API implementation on Node.js + MongoDB.","archived":false,"fork":false,"pushed_at":"2025-01-16T21:41:14.000Z","size":653,"stargazers_count":766,"open_issues_count":1,"forks_count":300,"subscribers_count":44,"default_branch":"master","last_synced_at":"2025-05-15T00:06:10.935Z","etag":null,"topics":["api","express","mongodb","nodejs","restful"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ealeksandrov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-09-11T13:39:36.000Z","updated_at":"2025-05-09T09:18:34.000Z","dependencies_parsed_at":"2023-02-13T03:00:26.449Z","dependency_job_id":"232f06ee-a916-41b2-9527-87287984a073","html_url":"https://github.com/ealeksandrov/NodeAPI","commit_stats":{"total_commits":94,"total_committers":9,"mean_commits":"10.444444444444445","dds":0.5851063829787234,"last_synced_commit":"cff6d1bf80ecb1659dfd805104c7ad70e13756fa"},"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ealeksandrov%2FNodeAPI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ealeksandrov%2FNodeAPI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ealeksandrov%2FNodeAPI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ealeksandrov%2FNodeAPI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ealeksandrov","download_url":"https://codeload.github.com/ealeksandrov/NodeAPI/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254249197,"owners_count":22039029,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","express","mongodb","nodejs","restful"],"created_at":"2024-10-14T10:12:22.466Z","updated_at":"2025-05-15T00:06:49.866Z","avatar_url":"https://github.com/ealeksandrov.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Node REST API\n\n[![CI Status](https://github.com/ealeksandrov/NodeAPI/workflows/CI/badge.svg?branch=master)](https://github.com/ealeksandrov/NodeAPI/actions)\n[![Dependency Status](https://img.shields.io/david/ealeksandrov/NodeAPI.svg)](https://david-dm.org/ealeksandrov/NodeAPI)\n[![Dependency Status](https://img.shields.io/david/dev/ealeksandrov/NodeAPI.svg)](https://david-dm.org/ealeksandrov/NodeAPI)\n[![License](https://img.shields.io/github/license/ealeksandrov/NodeAPI.svg)](LICENSE.md)\n\n`NodeAPI` is REST API server implementation built on top `Node.js` and `Express.js` with `Mongoose.js` for `MongoDB` integration. Access control follows `OAuth 2.0` spec with the help of `OAuth2orize` and `Passport.js`.\n\nThis is updated code that follows [RESTful API With Node.js + MongoDB](https://aleksandrov.ws/2013/09/12/restful-api-with-nodejs-plus-mongodb) article.\n\n## Running project\n\n## Manual\n\nYou need to have [Node.js](https://nodejs.org) and [MongoDB](https://www.mongodb.com) installed.\n\n### Node setup on macOS\n\n```sh\n# Update Homebrew before installing all dependencies\nbrew update\n\n# Install Node (+npm) with Homebrew\nbrew install node\n\n# Install npm dependencies in project folder\nnpm install\n```\n\n### MongoDB setup on macOS\n\n```sh\n# Install MongoDB with Homebrew\nbrew tap mongodb/brew\nbrew install mongodb-community\n\n# Create directory for MongoDB data\nmkdir -p ./data/mongo\n\n# Run MongoDB daemon process with path to data directory\nmongod --dbpath ./data/mongo\n```\n\n### Run server\n\n```sh\nnpm start\n# alias for\nnode bin/www\n```\n\n### Create demo data\n\n```sh\nnpm run-script generate\n# alias for\nnode generateData.js\n```\n\n## Docker\n\nYou need to have [Docker](https://www.docker.com/community-edition) installed.\n\n### Run server\n\n```sh\ndocker-compose up -d --build\n```\n\n### Create demo data\n\n```sh\ndocker exec nodeapi_node_api_1 node generateData.js\n```\n\n## Make Requests\n\nCreate and refresh access tokens:\n\n```sh\nhttp POST http://localhost:1337/api/oauth/token grant_type=password client_id=android client_secret=SomeRandomCharsAndNumbers username=myapi password=abc1234\nhttp POST http://localhost:1337/api/oauth/token grant_type=refresh_token client_id=android client_secret=SomeRandomCharsAndNumbers refresh_token=[REFRESH_TOKEN]\n```\n\nCreate your article data:\n\n```sh\nhttp POST http://localhost:1337/api/articles title='New Article' 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 ACCESS_TOKEN'\n```\n\nUpdate your article data:\n\n```sh\nhttp PUT http://localhost:1337/api/articles/EXISTING_ARTICLE_ID title='Updated Article' author='Jane Doe' description='This is now updated' Authorization:'Bearer ACCESS_TOKEN'\n```\n\nGet your data:\n\n```sh\nhttp http://localhost:1337/api/users/info Authorization:'Bearer ACCESS_TOKEN'\nhttp http://localhost:1337/api/articles Authorization:'Bearer ACCESS_TOKEN'\n```\n\n## Tests\n\n```sh\nnpm test\n# alias for\nnode ./test/server.test.js\n```\n\n## Modules used\n\nSome of non-standard modules used:\n\n* [express](https://www.npmjs.com/package/express)\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\nTest modules:\n\n* [tape](https://www.npmjs.com/package/tape)\n* [superagent](https://www.npmjs.com/package/superagent)\n\n## Tools used\n\n* [httpie](https://github.com/jkbr/httpie) - command line HTTP client\n\n### JSHint\n\n```sh\nnpm install jshint -g\njshint libs/**/*.js generateData.js\n```\n\n## Author\n\nCreated and maintained by Evgeny Aleksandrov ([@ealeksandrov](https://twitter.com/ealeksandrov)).\n\nUpdated by:\n\n* [Istock Jared](https://github.com/IstockJared)\n* [Marko Arsić](https://marsic.info/)\n* and other [contributors](https://github.com/ealeksandrov/NodeAPI/graphs/contributors)\n\n## License\n\n`NodeAPI` is available under the MIT license. See the [LICENSE.md](LICENSE.md) file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fealeksandrov%2Fnodeapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fealeksandrov%2Fnodeapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fealeksandrov%2Fnodeapi/lists"}