{"id":26120762,"url":"https://github.com/lamngockhuong/dummy-api","last_synced_at":"2026-02-14T15:02:35.860Z","repository":{"id":193326931,"uuid":"522868823","full_name":"lamngockhuong/dummy-api","owner":"lamngockhuong","description":"Create Dummy API Server by json-server","archived":false,"fork":false,"pushed_at":"2025-03-11T17:05:38.000Z","size":68,"stargazers_count":2,"open_issues_count":10,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-17T14:06:32.186Z","etag":null,"topics":["dummy-api","json-server","json-server-example","json-server-glitch","json-server-heroku"],"latest_commit_sha":null,"homepage":"https://dummy-api-test.herokuapp.com","language":"HTML","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/lamngockhuong.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,"zenodo":null}},"created_at":"2022-08-09T08:40:42.000Z","updated_at":"2022-10-02T10:33:30.000Z","dependencies_parsed_at":"2023-09-07T19:11:53.128Z","dependency_job_id":"e0fa1fd6-d57e-4297-8417-e01377973119","html_url":"https://github.com/lamngockhuong/dummy-api","commit_stats":null,"previous_names":["lamngockhuong/dummy-api"],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/lamngockhuong/dummy-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamngockhuong%2Fdummy-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamngockhuong%2Fdummy-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamngockhuong%2Fdummy-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamngockhuong%2Fdummy-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lamngockhuong","download_url":"https://codeload.github.com/lamngockhuong/dummy-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamngockhuong%2Fdummy-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29447768,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-14T14:10:32.461Z","status":"ssl_error","status_checked_at":"2026-02-14T14:09:49.945Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["dummy-api","json-server","json-server-example","json-server-glitch","json-server-heroku"],"created_at":"2025-03-10T13:52:32.320Z","updated_at":"2026-02-14T15:02:35.843Z","avatar_url":"https://github.com/lamngockhuong.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dummy-api\nDummy API\n\n- [Create your database](#create-your-database)\n- [Run on Docker](#run-on-docker)\n- [Deploy](#deploy)\n  * [Deploy to Heroku](#deploy-to-heroku)\n  * [Deploy to Glitch](#deploy-to-glitch)\n- [Refer](#refer)\n\u003c!-- toc --\u003e\n\n## Create your database\n1. Press `Use this template` button in the right corner\n2. Grive your new repository a name and press `Create repository from template` button\n3. Clone your newly created repository to your computer\n4. Change the contents of `db.json` and `routes.json` (optional) **to your own content** according to the [json-server example](https://github.com/typicode/json-server#example) and then commit your changes to git locally.\n\n+ This example will create `/users` route, each resource will have `id`, `name` and `email`\n```json\n// db.json\n{\n  \"users\": [\n    {\n      \"id\": 1,\n      \"name\": \"Ngoc Khuong\",\n      \"email\": \"me@ngockhuong.com\"\n    }\n  ]\n}\n```\n+ This example will define a custom route, search user by email\n```json\n// routes.json\n{\n  \"/users/email/:email\": \"/users?email=:email\"\n}\n```\n5. If you want to change home page template, please update the contents at `public/`\n\n## Run on Docker\nThe recommended way to run this container looks like this:\n\n```bash\n$ DB_FILE=db.json \u0026\u0026 ROUTES_FILE=routes.json \u0026\u0026 docker run -d \\\n--name dummy-api \\\n-p 3000:3000 \\\n-v $(pwd)/$DB_FILE:/app/db.json \\\n-v $(pwd)/$ROUTES_FILE:/app/routes.json \\\nlamngockhuong/dummy-api:latest\n```\n\nThe above example exposes the JSON Server REST API on port 3000, so that you can now browse to: [http://localhost:3000](http://localhost:3000)\n\nThis is a rather common setup following docker's conventions:\n\n+ `-d` will run a detached instance in the background\n+ `-p {OutsidePort}:3000` will bind the webserver to the given outside port\n+ `-v {AbsolutePathToDBJsonFile}:/app/db.json` should be passed to mount the given **DB** JSON file into the container\n+ `-v {AbsolutePathToRoutesJsonFile}:/app/routes.json` should be passed to mount the given **Routes** JSON file into the container\n+ `lamngockhuong/dummy-api` the name of this docker image\n\nWhen you update db.json or routes.json, please restart dummy-api container:\n```\n$ docker restart dummy-api\n```\n## Deploy\n### Deploy to Heroku\nHeroku is a free hosting service for small projects. Easy setup and deploy from the command line via *git*.\n\n**Pros**:\n+ Easy setup\n+ Free\n\n**Cons**:\n+ App has to sleep a couple of hours every day.\n+ \"Powers down\" after 30 mins of inactivity. Starts back up when you visit the site but it takes a few extra seconds. Can maybe be solved with [Kaffeine](http://kaffeine.herokuapp.com/)\n\n#### Install Heroku and deploy\n##### From Dashboard\n1. [Create your database](#create-your-database)\n2. Create an account on [https://heroku.com](https://heroku.com)\n3. Login and **Create new app**\n4. Go to **Deploy** tab \u003e **Deployment method** \u003e Choose **GitHub**\n5. Go to **Connect to GitHub**, connect to your github account and search your repository \u003e Click **Connect**\n6. Go to **Manual deploy** \u003e Choose a branch to deploy \u003e Press **Deploy Branch**\n7. Go to **Overview** tab to view build log and more.\n\n##### From CLI\n1. Install the Heroku CLI on your computer: [https://devcenter.heroku.com/articles/heroku-cli](https://devcenter.heroku.com/articles/heroku-cli)\n\n2. Connect the Heroku CLI to your account by writing the following command in your terminal and follow the instructions on the command line:\n```bash\nheroku login\n```\n\n3. Then create a remote heroku project, kinda like creating a git repository on GitHub. This will create a project on Heroku with a random name. If you want to name your app you have to supply your own name like `heroku create project-name`:\n```bash\nheroku create my-cool-project\n```\n\n4. Push your app to __Heroku__ (you will see a wall of code)\n```bash\ngit push heroku master\n```\n\n5. Visit your newly create app by opening it via heroku:\n```bash\nheroku open\n```\n\n6. For debugging if something went wrong:\n```bash\nheroku logs --tail\n```\n\n##### How it works\n\nHeroku will look for a startup-script, this is by default `npm start` so make sure you have that in your `package.json` (assuming your script is called `server.js`):\n```json\n \"scripts\": {\n    \"start\" : \"node server.js\"\n }\n```\nOr look **Procfile**:\n```\nweb: npm start\n```\n\nYou also have to make changes to the port, you can't hardcode a dev-port. But you can reference heroku port. So the code will have the following:\n```js\nconst port = process.env.PORT || 3000;\n```\n\n### Deploy to Glitch\nSame as Heroku, will sleep after a while.\n1. Register for [Glitch](https://glitch.com/)\n2. Click **New Project**\n3. Click **Import from GitHub**\n4. Paste the full URL of your repository `https://github.com/lamngockhuong/dummy-api.git` into the URL input and click OK.\n5. Wait for it to setup\n6. Go to **Settings** \u003e **Edit project details** \u003e Change Project Name. Then press **Save**\n7. Press **Share** button to get your URL to live site. It should be something for example like: [https://dummy-api-test.glitch.me](https://dummy-api-test.glitch.me)\n\n## Refer\n+ [JSON Server](https://github.com/typicode/json-server)\n+ [JSON Server Heroku](https://github.com/jesperorb/json-server-heroku)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flamngockhuong%2Fdummy-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flamngockhuong%2Fdummy-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flamngockhuong%2Fdummy-api/lists"}