{"id":15683193,"url":"https://github.com/raghavgarg1257/social-cops-app","last_synced_at":"2026-04-05T21:32:30.662Z","repository":{"id":114637603,"uuid":"91948257","full_name":"raghavgarg1257/social-cops-app","owner":"raghavgarg1257","description":"NodeJS web api end points","archived":false,"fork":false,"pushed_at":"2017-07-01T03:31:21.000Z","size":173,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-30T10:30:47.433Z","etag":null,"topics":["docker","es6","imagemagick","istanbul","jsonpatch","jwt","mocha","nodejs","nyc","sentry","swagger"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/raghavgarg1257.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2017-05-21T10:10:23.000Z","updated_at":"2017-05-26T05:54:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"d79a6a56-afac-4665-9403-b2040c437275","html_url":"https://github.com/raghavgarg1257/social-cops-app","commit_stats":{"total_commits":90,"total_committers":1,"mean_commits":90.0,"dds":0.0,"last_synced_commit":"48185a060c6ca363cedd236054c051f4db7fcb77"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/raghavgarg1257/social-cops-app","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raghavgarg1257%2Fsocial-cops-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raghavgarg1257%2Fsocial-cops-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raghavgarg1257%2Fsocial-cops-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raghavgarg1257%2Fsocial-cops-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raghavgarg1257","download_url":"https://codeload.github.com/raghavgarg1257/social-cops-app/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raghavgarg1257%2Fsocial-cops-app/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31451439,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T21:22:52.476Z","status":"ssl_error","status_checked_at":"2026-04-05T21:22:51.943Z","response_time":75,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["docker","es6","imagemagick","istanbul","jsonpatch","jwt","mocha","nodejs","nyc","sentry","swagger"],"created_at":"2024-10-03T17:03:06.733Z","updated_at":"2026-04-05T21:32:30.566Z","avatar_url":"https://github.com/raghavgarg1257.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Social Cops Node JS Task\n\nThe [problem statement](https://github.com/raghavgarg1257/social-cops-app/blob/master/NodejsTask.pdf) has been uploaded in the repo.\n\nUsing ES6 syntax, with [Babel](http://babeljs.io/).\n\n\n## Demo (its currently down/not working)\nYou can use the undergiven ip address to make the request using [Postman](https://chrome.google.com/webstore/detail/postman/fhbjgbiflinjbdggehcddcbncdddomop?hl=en). It is hosted on AWS.\n\n    http://35.163.21.122:8000\n\n\n## Task Assessment\nThe [task progress](https://github.com/raghavgarg1257/social-cops-app/blob/master/TaskAssessment.md) according to the [NodejsTask.pdf](https://github.com/raghavgarg1257/social-cops-app/blob/master/NodejsTask.pdf).\n\n\n## Pre-requisite\n1. [NodeJS](https://nodejs.org/en/)\n2. Globally installed [nodemon](https://nodemon.io/) (to use `npm run dev`)\n3. Globally installed [istanbul](https://istanbul.js.org/) (to use `npm run cover`)\n\n\n## Setup\n    git clone git@github.com:raghavgarg1257/social-cops-app.git\n    cd social-cops-app\n    cp .env.example .env\n    nano .env # optional, you can set port and jwt secret and sentry dns for logging errors\n    npm install\n    npm start # the server will be started and link will be printed in the terminal\n\n\n## Available Npm Script\n    npm install # to install depensencies\n    npm start # to start the server\n    npm run dev # to start the server with nodemon, to develop\n    npm test # to run test\n    npm run nyc # to run test with code coverage report in terminal\n    npm run cover # to get code coverage as an html file\n\n\n## Usage (available routes)\nThe routes can be tested using [Postman](https://chrome.google.com/webstore/detail/postman/fhbjgbiflinjbdggehcddcbncdddomop?hl=en) or you can use [Swagger Docs](https://github.com/raghavgarg1257/social-cops-app/tree/master/swagger-docs-server).\n\n**Note:** to use protected routes an extra header needs to be added in request of format like:\n```\nHEADER {\n    \"Authorization\" : \"Bearer JWT_TOKEN\" # note the space between keyword Bearer and JWT_TOKEN\n}\n```\n```\ntype: public\nreq: GET /\nres: Text\n```\n```\ntype: public\nreq: POST /\nres: Text\n```\n```\ndesc: login route, user can send username and password, and recieve JWT_TOKEN.\n    : JWT_TOKEN can be used to making request to protected routes.\n    : Currently no authentication process is in place, every username and password will be processed.\ntype: public\nreq: POST /login {\n    \"username\" : String,\n    \"password\" : String\n}\nres:{\n    \"message\": String,\n    \"data\": {\n        \"username\": String,\n        \"token\": JWT_TOKEN\n    }\n}\n```\n```\ndesc: json-patch route, user can send json and patch(http://jsonpatch.com/), and recieve new json.\ntype: protected\nreq: POST /json-patch {\n    json : JSON Object,\n    patch: JSON Patch Object\n}\nres: JSON Object (after applying the patch)\n```\n```\ndesc: image thumbnail route, user can send public image url, and recieve 50x50 pixel image as response.\n    : the url with 'https' will not work.\ntype: protected\nreq: POST /img-thumb {\n    url : String (valid image url)\n}\nres: Image\n```\n\n## Test Suite\nTo run normal test\n\n    npm test\n\nTo run test with code coverage report in terminal\n\n    npm run nyc\n\nTo get code coverage report in html\n\n    npm run cover # then open index.html in /coverage/Icov-report/index/html\n\n\n## Deploy using Docker\n**Note:** exposed port is `8000`\n\nTo build docker image\n\n    docker build -t node-task .\n\nTo run the docker image\n\n    docker run -p 3000:8000 -d node-task\n\n\n## Swagger Docs ([more details](https://github.com/raghavgarg1257/social-cops-app/tree/master/swagger-docs-server))\n**Note:** keep an open daemon of actual server.\n\n**Note:** To use protected route, run `/login`, then copy `token` value from it's response and paste in the top right corner of the screen, then click `explore`.\n\n**Note:** `/img-thumb` would not be tested with it properly as an image is the response of the route and swagger is not able to show it.\n\n    cd swagger-docs-server\n    npm start # link will be printed in the terminal\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraghavgarg1257%2Fsocial-cops-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraghavgarg1257%2Fsocial-cops-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraghavgarg1257%2Fsocial-cops-app/lists"}