{"id":15321952,"url":"https://github.com/akmamun/food-api-integration","last_synced_at":"2026-05-09T15:17:41.266Z","repository":{"id":106930793,"uuid":"209141682","full_name":"akmamun/food-api-integration","owner":"akmamun","description":"React API integration of food2fork.com","archived":false,"fork":false,"pushed_at":"2019-10-02T15:23:30.000Z","size":190,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-01T21:14:01.739Z","etag":null,"topics":["api-integration","food-app","food2fork","public-api","reactjs"],"latest_commit_sha":null,"homepage":"http://foodapp-food2fork-dev.surge.sh","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/akmamun.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":"2019-09-17T19:38:45.000Z","updated_at":"2024-03-03T04:31:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"01ba713d-d90c-4906-9801-78a248c4d8b5","html_url":"https://github.com/akmamun/food-api-integration","commit_stats":{"total_commits":8,"total_committers":1,"mean_commits":8.0,"dds":0.0,"last_synced_commit":"c9b0be9f10545a4e4b5981ad81361d0687c5074c"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akmamun%2Ffood-api-integration","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akmamun%2Ffood-api-integration/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akmamun%2Ffood-api-integration/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akmamun%2Ffood-api-integration/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akmamun","download_url":"https://codeload.github.com/akmamun/food-api-integration/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245898334,"owners_count":20690466,"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-integration","food-app","food2fork","public-api","reactjs"],"created_at":"2024-10-01T09:13:44.152Z","updated_at":"2026-05-09T15:17:41.238Z","avatar_url":"https://github.com/akmamun.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Food App Integration of [food2fork](https://www.food2fork.com/about/api) API\n\n# Add API KEY to [route](src/route.js)\n- food2fork gives only 50 api calling for free, if don't show\nany data create an account in [food2fork](https://www.food2fork.com/default/user/register)\nand copy API Key from [here](https://www.food2fork.com/user/api) and added to [route](src/route.js)\n```sh\nconst apiKey = \"food2fork api key\";\n```\n# Code Architecture\n## State Management\n- Use react core state management\n\n## Component Structure and module CSS\n- `filename.module.css`: use module css for avoid global css issue\n- global css contains only `App.css` and `index.css` file\n\n### In [Api](src/api.js) File Define api helper  \n```js\nimport axios from \"axios\";\n\n/* description: this function for callback api endpoint\n                 contains GET,POST,PUT, DELETE requests via axios package\n\n   params: id , data\n         - getOne method need only id params\n         - getAll method no need any param\n         - create method need only data param\n         - updateByID method need both id and data params\n         - update method need only data param\n         - delete method also need only id param\n\n   return: getOne, getAll, updateByID, update, delete\n*/\n\nexport default {\n    endpoint(url) {\n        url = \"route.apiBase\" + url; //concat base url and url with base api endpoint\n        return {\n            getOne: (id) =\u003e axios.get(url + `/${id}`), //id_url\n            getAll: () =\u003e axios.get(url),\n            create: (data) =\u003e axios.post(url, data), //url, data\n            updateByID: (id, data) =\u003e axios.put(url + `/${id}`, data), //url, data\n            update: (data) =\u003e axios.put(url, data),  // without id\n            delete: (id) =\u003e axios.delete(url + `/${id}`),\n        }\n    },\n}\n```\n### [route](src/route.js) contains `apiRoute` and `localRoute` route.\n- In this file `apiRoute` contains api route where define all api endpoint and `localRoute` contains local traverse route which responsible for traverse from react app \n### Uses of [api](src/api.js) helper and [route](src/route.js) \n```js\napi.endpoint(url).getAll()\napi.endpoint(url).getOne({id})\napi.endpoint(url).create( data)\napi.endpoint(url).update({ id }, data)\napi.endpoint(url).delete({ id })\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakmamun%2Ffood-api-integration","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakmamun%2Ffood-api-integration","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakmamun%2Ffood-api-integration/lists"}