{"id":17651766,"url":"https://github.com/diegovictor/functional-api","last_synced_at":"2025-05-07T07:16:14.140Z","repository":{"id":98964038,"uuid":"472967512","full_name":"DiegoVictor/functional-api","owner":"DiegoVictor","description":"Study Case API with SOLID and no OOP","archived":false,"fork":false,"pushed_at":"2025-02-15T03:19:48.000Z","size":1240,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-05T08:42:42.878Z","etag":null,"topics":["api","api-rest","dependency-injection","firebase","firestore","functional-api","javascript","jest","js","microservices","node","nodejs","tests","ts","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":"2022-03-22T23:13:44.000Z","updated_at":"2025-02-15T03:19:51.000Z","dependencies_parsed_at":"2025-02-15T04:19:21.406Z","dependency_job_id":"10172149-35f1-4f9f-955e-35a26bafa25e","html_url":"https://github.com/DiegoVictor/functional-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%2Ffunctional-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiegoVictor%2Ffunctional-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiegoVictor%2Ffunctional-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DiegoVictor%2Ffunctional-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DiegoVictor","download_url":"https://codeload.github.com/DiegoVictor/functional-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242930184,"owners_count":20208414,"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","api-rest","dependency-injection","firebase","firestore","functional-api","javascript","jest","js","microservices","node","nodejs","tests","ts","typescript"],"created_at":"2024-10-23T11:43:33.651Z","updated_at":"2025-03-10T21:31:08.310Z","avatar_url":"https://github.com/DiegoVictor.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Functional API\n[![AppVeyor](https://img.shields.io/appveyor/build/diegovictor/functional-api?logo=appveyor\u0026style=flat-square)](https://ci.appveyor.com/project/DiegoVictor/functional-api)\n[![firestore](https://img.shields.io/badge/firestore-ffca28?style=flat-square\u0026logo=firebase\u0026logoColor=black)](https://firebase.google.com/)\n[![firebase](https://img.shields.io/static/v1?label=firebase\u0026style=flat-square\u0026message=11.10.1\u0026color=ffca28\u0026logo=firebase)](https://firebase.google.com/)\n[![babel](https://img.shields.io/badge/babel-7.22.11-F9DC3E?style=flat-square\u0026logo=babel)](https://babeljs.io/)\n[![prettier](https://img.shields.io/badge/prettier-3.0.3-F7B93E?style=flat-square\u0026logo=prettier)](https://prettier.io/)\n[![nodemon](https://img.shields.io/badge/nodemon-3.0.1-76d04b?style=flat-square\u0026logo=nodemon)](https://nodemon.io/)\n[![eslint](https://img.shields.io/badge/eslint-8.48.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.6.4-brightgreen?style=flat-square\u0026logo=jest)](https://jestjs.io/)\n[![typescript](https://img.shields.io/badge/typescript-5.2.2-3178c6?style=flat-square\u0026logo=typescript)](https://www.typescriptlang.org/)\n[![coverage](https://img.shields.io/codecov/c/gh/DiegoVictor/functional-api?logo=codecov\u0026style=flat-square)](https://app.codecov.io/gh/DiegoVictor/functional-api)\n[![MIT License](https://img.shields.io/badge/license-MIT-green?style=flat-square)](https://raw.githubusercontent.com/DiegoVictor/functional-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=Functional%20API\u0026uri=https%3A%2F%2Fraw.githubusercontent.com%2FDiegoVictor%2Ffunctional-api%2Fmain%2FInsomnia_2024-11-28.json)\n\nStudy Case to figure out a simple way to have dependency injection and dependency inversion principle using only functions (not classes here, sorry OOP guys).\n\u003e This API makes usage of a external service that generates random names, see more in: [Named API](https://github.com/DiegoVictor/named-api) and [Named Web](https://github.com/DiegoVictor/named-web).\n\n## Table of Contents\n* [Requirements](#requirements)\n* [Installing](#installing)\n  * [Firebase](#firebase)\n    * [Service Account](#service-account)\n    * [Script](#script)\n* [Development](#development)\n* [Usage](#usage)\n  * [Deploy](#deploy)\n  * [Routes](#routes)\n* [Running the tests](#running-the-tests)\n  * [Coverage report](#coverage-report)\n\n# Requirements\n  * Node.js ^18.19.0\n  * Firebase Account\n    * [Functions](https://firebase.google.com/docs/functions)\n    * [Firestore](https://firebase.google.com/docs/firestore)\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## Firebase\nFirst, [create a project into Firebase](https://firebase.google.com/docs/android/setup#create-firebase-project), then [create a database](https://firebase.google.com/docs/firestore/quickstart).\n\n### Service Account\nCreate a service account:\n\n* [Service Account](https://console.firebase.google.com/project/_/settings/serviceaccounts/adminsdk?authuser=0)\n\nThen save it in `src\\config\\service-account.json`.\n\n### Script\nThere is a script (`scripts/main.js`) that setup a feature flag required by the application, to run:\n```\n$ node scripts/main.js\n```\nNow your are ready to go\n\n# Development\nImprove the development velocity running the `watch` script to rebuild the project everytime a file in `src` folder changes.\n```\nnpm run watch\n```\nOr:\n```\nyarn watch\n```\n\u003e Then you can just run the `serve` script once.\n\n# Usage\nRun the `build` script:\n```\nnpm run build\n```\nOr:\n```\nyarn build\n```\nThen you are ready to start the server:\n```\nnpm run serve\n```\nOr:\n```\nyarn serve\n```\n\n## Deploy\n```\nnpm run deploy\n```\nOr:\n```\nyarn deploy\n```\n\u003e Deploy the functions is very easy, but is requires a [Blaze (pay-as-you-go) plan](https://firebase.google.com/pricing?authuser=0\u0026hl=pt).\n\n## Routes\nroute|HTTP Method|params|description\n---|---|---|---\n`/featureFlags`|GET| - |Returns all flags in the database.\n`/featureFlags/:key`|GET| `key` of the flag.|Returns the specified flag.\n`/randomNames`|GET| - | Returns random names in raw text or in base64 format (depends if the flag is enable or not).\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\u003e Run the command in the root folder\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%2Ffunctional-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdiegovictor%2Ffunctional-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiegovictor%2Ffunctional-api/lists"}