{"id":17651745,"url":"https://github.com/diegovictor/tindev-api","last_synced_at":"2026-02-06T08:38:38.127Z","repository":{"id":98964728,"uuid":"328224904","full_name":"DiegoVictor/tindev-api","owner":"DiegoVictor","description":"Project developed during the OmniStack Week 8.0 ","archived":false,"fork":false,"pushed_at":"2025-01-09T14:29:11.000Z","size":948,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-09T15:37:01.165Z","etag":null,"topics":["api","databases","docker","editorconfig","insomnia","javascript","js","mongodb","node","nodejs","omnistack","redis","rocketseat","tindev"],"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/DiegoVictor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2021-01-09T18:54:43.000Z","updated_at":"2025-01-09T14:29:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"46604246-94df-46de-96d9-6ec909f672aa","html_url":"https://github.com/DiegoVictor/tindev-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiegoVictor%2Ftindev-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiegoVictor%2Ftindev-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiegoVictor%2Ftindev-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiegoVictor%2Ftindev-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DiegoVictor","download_url":"https://codeload.github.com/DiegoVictor/tindev-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238620231,"owners_count":19502412,"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","databases","docker","editorconfig","insomnia","javascript","js","mongodb","node","nodejs","omnistack","redis","rocketseat","tindev"],"created_at":"2024-10-23T11:43:28.893Z","updated_at":"2025-10-28T08:31:18.826Z","avatar_url":"https://github.com/DiegoVictor.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [API] Tindev\n[![AppVeyor](https://img.shields.io/appveyor/build/diegovictor/tindev-api?logo=appveyor\u0026style=flat-square)](https://ci.appveyor.com/project/DiegoVictor/tindev-api)\n[![mongodb](https://img.shields.io/badge/mongodb-6.9.0-13aa52?style=flat-square\u0026logo=mongodb\u0026logoColor=white)](https://www.mongodb.com/)\n[![redis](https://img.shields.io/badge/redis-4.7.0-d92b21?style=flat-square\u0026logo=redis\u0026logoColor=white)](https://redis.io/)\n[![nodemon](https://img.shields.io/badge/nodemon-3.1.7-76d04b?style=flat-square\u0026logo=nodemon)](https://nodemon.io/)\n[![eslint](https://img.shields.io/badge/eslint-8.57.1-4b32c3?style=flat-square\u0026logo=eslint)](https://eslint.org/)\n[![airbnb-style](https://flat.badgen.net/badge/style-guide/airbnb/ff5a5f?icon=airbnb)](https://github.com/airbnb/javascript)\n[![jest](https://img.shields.io/badge/jest-29.7.0-brightgreen?style=flat-square\u0026logo=jest)](https://jestjs.io/)\n[![coverage](https://img.shields.io/codecov/c/gh/DiegoVictor/tindev-api?logo=codecov\u0026style=flat-square)](https://codecov.io/gh/DiegoVictor/tindev-api)\n[![MIT License](https://img.shields.io/badge/license-MIT-green?style=flat-square)](https://raw.githubusercontent.com/DiegoVictor/tindev-api/main/LICENSE)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)\u003cbr\u003e\n[![Run in Insomnia}](https://insomnia.rest/images/run.svg)](https://insomnia.rest/run/?label=Tindev\u0026uri=https%3A%2F%2Fraw.githubusercontent.com%2FDiegoVictor%2Ftindev-api%2Fmain%2FInsomnia_2024-08-01.json)\n\nResponsible for provide data to the [`web`](https://github.com/DiegoVictor/tindev-web) and [`mobile`](https://github.com/DiegoVictor/tindev-app) front-ends. Allows users to register yourself, see other registered users, like or dislake them and see past matches. The app has friendly errors, use JWT to logins, validation, also a simple versioning was made.\n\n## Table of Contents\n* [Installing](#installing)\n  * [Configuring](#configuring)\n    * [Redis](#redis)\n    * [MongoDB](#mongodb)\n    * [.env](#env)\n* [Usage](#usage)\n  * [Error Handling](#error-handling)\n    * [Errors Reference](#errors-reference)\n  * [X-Total-Count](#x-total-count)\n  * [Bearer Token](#bearer-token)\n  * [Versioning](#versioning)\n  * [Routes](#routes)\n    * [Requests](#requests)\n* [Running the tests](#running-the-tests)\n  * [Coverage report](#coverage-report)\n\n# Installing\nEasy peasy lemon squeezy:\n```\n$ yarn\n```\nOr:\n```\n$ npm install\n```\n\u003e Was installed and configured the [`eslint`](https://eslint.org/) and [`prettier`](https://prettier.io/) to keep the code clean and patterned.\n\n## Configuring\nThe application uses two databases: [MongoDB](https://www.mongodb.com/) and [Redis](https://redis.io/). For the fastest setup is recommended to use [docker-compose](https://docs.docker.com/compose/), you just need to up all services:\n```\n$ docker-compose up -d\n```\n\n### Redis\nResponsible to store data utilized by the websocket to alert users when a match occurs. If for any reason you would like to create a Redis container instead of use `docker-compose`, you can do it by running the following command:\n```\n$ docker run --name tindev-redis -d -p 6379:6379 redis:alpine\n```\n\n### MongoDB\nStore all data utilized by the application. If for any reason you would like to create a MongoDB container instead of use `docker-compose`, you can do it by running the following command:\n```\n$ docker run --name tindev-mongo -d -p 27017:27017 mongo\n```\n\n### .env\nIn this file you may configure your Redis database connection, JWT settings, the environment, app's port and a url to documentation (this will be returned with error responses, see [error section](#error-handling)). Rename the `.env.example` in the root directory to `.env` then just update with your settings.\n\n|key|description|default\n|---|---|---\n|APP_PORT|Port number where the app will run.|`3333`\n|JWT_SECRET|A alphanumeric random string. Used to create signed tokens.| -\n|JWT_EXPIRATION_TIME|How long time will be the token valid. See [jsonwebtoken](https://github.com/auth0/node-jsonwebtoken#usage) repo for more information.|`7d`\n|MONGO_URL|MongoDB connection url.|`mongodb://mongo:27017/tindev`\n|REDIS_HOST|Redis host. |`redis`\n|REDIS_PORT|Redis port.|`6379`\n|DOCS_URL|An url to docs where users can find more information about the app's internal code errors.|`https://github.com/DiegoVictor/tindev-api#errors-reference`\n\n# Usage\nTo start up the app run:\n```\n$ yarn dev:server\n```\nOr:\n```\nnpm run dev:server\n```\n\n## Error Handling\nInstead of only throw a simple message and HTTP Status Code this API return friendly errors:\n```json\n{\n  \"statusCode\": 400,\n  \"error\": \"Bad Request\",\n  \"message\": \"Developer not exists\",\n  \"code\": 240,\n  \"docs\": \"https://github.com/DiegoVictor/tindev-api#errors-reference\"\n}\n```\n\u003e Errors are implemented with [@hapi/boom](https://github.com/hapijs/boom).\n\u003e As you can see a url to error docs are returned too. To configure this url update the `DOCS_URL` key from `.env` file.\n\u003e In the next sub section ([Errors Reference](#errors-reference)) you can see the errors `code` description.\n\n### Errors Reference\n|code|message|description\n|---|---|---\n|141|Token not provided|The JWT token was not sent.\n|142|Token invalid|The JWT token provided is invalid or expired.\n|240|Developer not exists|The `id` sent does not references an existing developer in the database.\n\n### X-Total-Count\nA header returned in routes of listing, this bring the total records amount.\n\n## Bearer Token\nA few routes expect a Bearer Token in an `Authorization` header.\n\u003e You can see these routes in the [routes](#routes) section.\n```\nGET http://localhost:3333/v1/developers Authorization: Bearer \u003ctoken\u003e\n```\n\u003e To achieve this token you just need authenticate through the `/developers` route and it will return the `token` key with a valid Bearer Token.\n\n## Versioning\nA simple versioning was made. Just remember to set after the `host` the `/v1/` string to your requests.\n```\nGET http://localhost:3333/v1/developers\n```\n\n## Routes\n|route|HTTP Method|params|description|auth method\n|:---|:---:|:---:|:---:|:---:\n|`/developers`|POST|Body with Github `username`.|Authenticates users, return a Bearer Token and user's data.|:x:\n|`/developers`|GET| - |List developers not liked or disliked yet.|Bearer\n|`/developers/:id`|GET|`id` of the developer.|Return one developer.|Bearer\n|`/developers/:liked_user_id/like`|POST|`liked_user_id` of the developer to like.|Like a developer.|Bearer\n|`/developers/:disliked_user_id/like`|POST|`disliked_user_id` of the developer to dislike.|Dislike a developer.|Bearer\n|`/matches`|GET| - |List developers you liked in the past.|Bearer\n\n\u003e Routes with `Bearer` as auth method expect an `Authorization` header. See [Bearer Token](#bearer-token) section for more information.\n\n### Requests\n* `POST /developers`\n\nRequest body:\n```json\n{\n  \"username\": \"diegovictor\"\n}\n```\n\n# Running the tests\n[Jest](https://jestjs.io/) was the choice to test the app, to run:\n```\n$ yarn test\n```\nOr:\n```\n$ npm run test\n```\n\n## Coverage report\nYou can see the coverage report inside `tests/coverage`. They are automatically created after the tests run.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiegovictor%2Ftindev-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdiegovictor%2Ftindev-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiegovictor%2Ftindev-api/lists"}