{"id":22935130,"url":"https://github.com/sofidevo/react-router-api","last_synced_at":"2025-08-02T04:04:35.861Z","repository":{"id":192365928,"uuid":"686591394","full_name":"SofiDevO/react-router-api","owner":"SofiDevO","description":"Fake api for my project: React Router","archived":false,"fork":false,"pushed_at":"2023-09-03T10:07:02.000Z","size":42,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"sofidev","last_synced_at":"2025-04-01T18:54:38.025Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://react-router-api-jet.vercel.app","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/SofiDevO.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":"sofidev","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2023-09-03T10:06:32.000Z","updated_at":"2023-09-03T10:07:40.000Z","dependencies_parsed_at":"2023-09-04T13:15:40.787Z","dependency_job_id":null,"html_url":"https://github.com/SofiDevO/react-router-api","commit_stats":null,"previous_names":["sofidevo/react-router-api"],"tags_count":0,"template":false,"template_full_name":"SofiDevO/alurageek-API","purl":"pkg:github/SofiDevO/react-router-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SofiDevO%2Freact-router-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SofiDevO%2Freact-router-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SofiDevO%2Freact-router-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SofiDevO%2Freact-router-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SofiDevO","download_url":"https://codeload.github.com/SofiDevO/react-router-api/tar.gz/refs/heads/sofidev","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SofiDevO%2Freact-router-api/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268333968,"owners_count":24233782,"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","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-12-14T11:46:33.904Z","updated_at":"2025-08-02T04:04:35.825Z","avatar_url":"https://github.com/SofiDevO.png","language":"JavaScript","funding_links":["https://ko-fi.com/sofidev"],"categories":[],"sub_categories":[],"readme":"[spanish](https://github.com/SofiDevO/alurageek-API/tree/spanish)\n\n## Deploy JSON Server to Vercel\n\nA template for deploying [JSON Server](https://github.com/typicode/json-server) on [Vercel](https://vercel.com), allowing you to run a fake REST API online 🐣!\n\nDemo from this repository: \nhttps://alurageek-api.vercel.app/\n### How to use (resume)\n\n1. Click \"**Use this template**\" or clone this repository.\n2. Update or use the default [`db.json`](./db.json) in the repository.\n3. Sign up or log in to [Vercel](https://vercel.com).\n4. From the Vercel dashboard, click \"**+ New Project**\" and then \"**Import**\" your repository.\n5. On the \"**Configure Project**\" screen, leave everything as default and click \"**Deploy**\".\n6. Wait until deployment is complete, and your custom JSON server will be ready to serve!\n\n## Default `db.json`\n\n```json\n{\n \"product\": [\n        {\n            \"img\": \"https://www.claroshop.com/c/star-wars-day/img/categorias/TAZAS_CATEGORIAS_STAR_WARS.png\",\n            \"name\": \"Trooper mug\",\n            \"price\": \"$60.00\",\n            \"description\": \"Trooper helmet mug\",\n            \"category\": \"starwars\",\n            \"id\": 1\n        },\n        {\n            \"img\": \"https://cdn1.coppel.com/images/catalog/mkp/1773/5000/17733590-1.jpg\",\n            \"name\": \"Vader Funko\",\n            \"price\": \"$60.00\",\n            \"description\": \"Collectible Funko of Darth Vader\",\n            \"category\": \"starwars\",\n            \"id\": 2\n        }\n ]\n}\n```\n\n## Build It Yourself\n\nIf you'd like to create the project from scratch, I have a [YouTube video Tutorial (Spanish) that guides you through deploying your own fake API with db-json and Vercel.](https://www.youtube.com/channel/UC36_js-krsAHAEAWpEDhHtw) \n\n### Step 1\n\nCreate a new repository, for example, **alurageek-API**. Then clone that empty repository.\n\n### Step 2\n\nYou need to run the npm init command:\n```\nnpm init -y\n```\n\nThis will generate a **package.json**. Now, what you need to do is change these lines:\n\nChange this line:\n``` \n \"main\": \"index.js\",\n```\n\nTo this:\n\n```\n  \"main\": \"api/server.js\",\n```\n\nAnd this:\n\n```\n\"test\": \"echo \\\"Error: no test specified\\\" \u0026\u0026 exit 1\"\n```\n\nTo this:\n\n```\n\"start\": \"node api/server.js\"\n```\n\n### Step 3\n\nNow it's time to run the command:\n\n```\nnpm install json-server cors\n```\n\n![Alt text](image.png)\n\nYou'll see that both **cors** and ***json-server*** have been added to the package.json.\n\n### Step 4\n\nRun the command:\n```\nnpm install json-server\n```\n\nAdd the ***.gitignore*** file and add ***node_modules***.\n\n### Step 5\n\nCreate a ***db.json*** file and add your own data.\n\nAdditionally, you'll need to add a new [Folder called ***api***](./api/)  and, inside it, this [**server.js**](./api/server.js) file:\n\n```javascript\n// See https://github.com/typicode/json-server#module\nconst jsonServer = require('json-server')\nconst server = jsonServer.create()\nconst router = jsonServer.router('db.json')\nconst middlewares = jsonServer.defaults()\n\nserver.use(middlewares)\n// Add this before server.use(router)\nserver.use(jsonServer.rewriter({\n    '/api/*': '/$1',\n    '/product/:resource/:id/show': '/:resource/:id'\n}))\nserver.use(router)\nserver.listen(3000, () =\u003e {\n    console.log('JSON Server is running')\n})\n\n// Export the Server API\nmodule.exports = server\n```\n\n### Step 6\n\nCreate a new file named [***vercel.json***](./vercel.json)\n\n```json\n{\n  \"functions\": {\n    \"api/server.js\": {\n      \"memory\": 1024,\n      \"includeFiles\": \"db.json\"\n    }\n  },\n  \"rewrites\": [\n    {\n      \"source\": \"/(.*)\",\n      \"destination\": \"api/server.js\"\n    }\n  ]\n}\n```\n\n# Don't forget to commit \u0026 push your changes 🐣\n\nGo to your Vercel account, connect a new project with your repository, and deploy it💙\n\n## You must be patient\n\nIt could take a couple of minutes to finally work. ⏰🥹\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsofidevo%2Freact-router-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsofidevo%2Freact-router-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsofidevo%2Freact-router-api/lists"}