{"id":17651750,"url":"https://github.com/diegovictor/happy-api","last_synced_at":"2025-05-07T07:29:25.797Z","repository":{"id":98964580,"uuid":"303689391","full_name":"DiegoVictor/happy-api","owner":"DiegoVictor","description":"Project built during Rocketseat's Next Level Week #3 ","archived":false,"fork":false,"pushed_at":"2025-03-24T02:26:47.000Z","size":968,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-31T07:41:20.396Z","etag":null,"topics":["coverage-report","editorconfig","eslint","happy","javascript","js","nextlevelweek","nextlevelweek-booster","nlw","nlw-booster","node","nodejs","rocketseat","sqlite","sqlite3","ts","typeorm","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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":"2020-10-13T12:04:47.000Z","updated_at":"2025-03-24T02:26:51.000Z","dependencies_parsed_at":"2025-03-24T03:23:54.305Z","dependency_job_id":"75af189c-803c-423d-bc2a-60d420787dfd","html_url":"https://github.com/DiegoVictor/happy-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%2Fhappy-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiegoVictor%2Fhappy-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiegoVictor%2Fhappy-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiegoVictor%2Fhappy-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DiegoVictor","download_url":"https://codeload.github.com/DiegoVictor/happy-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252833181,"owners_count":21811128,"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":["coverage-report","editorconfig","eslint","happy","javascript","js","nextlevelweek","nextlevelweek-booster","nlw","nlw-booster","node","nodejs","rocketseat","sqlite","sqlite3","ts","typeorm","typescript"],"created_at":"2024-10-23T11:43:29.449Z","updated_at":"2025-05-07T07:29:25.771Z","avatar_url":"https://github.com/DiegoVictor.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [API] Happy\n[![CircleCI](https://img.shields.io/circleci/build/github/DiegoVictor/happy-api?style=flat-square\u0026logo=circleci)](https://app.circleci.com/pipelines/github/DiegoVictor/happy-api?branch=main)\n[![sqlite3](https://img.shields.io/badge/sqlite-5.1.7-003b57?style=flat-square\u0026logo=sqlite\u0026logoColor=white)](https://www.sqlite.org)\n[![typescript](https://img.shields.io/badge/typescript-5.5.4-3178c6?style=flat-square\u0026logo=typescript)](https://www.typescriptlang.org/)\n[![eslint](https://img.shields.io/badge/eslint-8.57.0-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/happy-api?logo=codecov\u0026style=flat-square)](https://codecov.io/gh/DiegoVictor/happy-api)\n[![MIT License](https://img.shields.io/badge/license-MIT-green?style=flat-square)](https://raw.githubusercontent.com/DiegoVictor/happy-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=Happy\u0026uri=https%3A%2F%2Fraw.githubusercontent.com%2FDiegoVictor%2Fhappy-api%2Fmain%2FInsomnia_2024-08-11.json)\n\nResponsible for provide data to the [`web`](https://github.com/DiegoVictor/happy-web) and [`mobile`](https://github.com/DiegoVictor/happy-app) front-ends. Permit to register orphanages. The app has validation, also a simple versioning was made.\n\n## Table of Contents\n* [Installing](#installing)\n  * [Configuring](#configuring)\n    * [SQLite](#sqlite)\n      * [Migrations](#migrations)\n    * [.env](#env)\n* [Usage](#usage)\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 use just one database: [SQLite](https://www.sqlite.org/index.html). For the fastest setup is recommended to use [docker-compose](https://docs.docker.com/compose/), you just need to up all services:\n\n```\n$ docker-compose up -d\n```\n\n### SQLite\nStore the orphanages. For more information to how to setup your database see:\n* [typeorm](https://typeorm.io/#/using-ormconfig)\n\u003e You can find the application's `ormconfig.json` file in the root folder.\n\n#### Migrations\nRemember to run the database migrations:\n```\n$ yarn ts-node-dev ./node_modules/typeorm/cli.js migration:run -- -d ./src/database/datasource.ts\n```\nOr:\n```\n$ yarn typeorm migration:run -- -d ./src/database/datasource.ts\n```\n\u003e See more information on [TypeORM Migrations](https://typeorm.io/#/migrations).\n\n### .env\nIn this file you may configure your app's port and a url. 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|BASE_URL|App's url.|`http://localhost:3333`\n\n# Usage\nTo start up the app run:\n```\n$ yarn dev:server\n```\nOr:\n```\nnpm run dev:server\n```\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/orphanages\n```\n\n## Routes\n|route|HTTP Method|params|description\n|:---|:---:|:---:|:---:\n|`/orphanages`|GET| - |Lists orphanages.\n|`/orphanages/:id`|GET|`:id` of the orphanage.|Return one orphanage.\n|`/orphanages`|POST|Body with new orphanage [form data](https://developer.mozilla.org/docs/Web/API/FormData) (See insomnia file for good example).|Create a new orphanage.\n\n### Requests\n* `POST /orphanages`\n\nRequest body:\n```multipart\n{\n  \"name\": \"Hackett, Becker and Fadel\",\n  \"latitude\": -85.8713,\n  \"longitude\": -73.3957,\n  \"about\": \"Adipisci cupiditate illo rerum sunt tempore. Non voluptate laborum enim hic tenetur perspiciatis sint. Quo totam recusandae dolores et ullam commodi. Ut consectetur saepe id voluptatem et quidem. Dolor neque consequuntur ipsa. Placeat sit aut nostrum similique dolorem voluptatem et velit enim.\",\n  \"instructions\": \"Venha visitar\",\n  \"opening_hours\": \"Das 8h às 18h\",\n  \"open_on_weekends\": true,\n  \"images\": \u003cfile(s)\u003e\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%2Fhappy-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdiegovictor%2Fhappy-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiegovictor%2Fhappy-api/lists"}