{"id":20827266,"url":"https://github.com/ccnokes/bogus-api","last_synced_at":"2026-04-20T18:31:51.868Z","repository":{"id":88144002,"uuid":"46838895","full_name":"ccnokes/bogus-api","owner":"ccnokes","description":"Mock API server for front-end development. Based on json-server and allows for multiple resources, short-circuiting responses, and a proxy server fallback.","archived":false,"fork":false,"pushed_at":"2016-02-09T15:51:37.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-12T07:29:54.887Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/ccnokes.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}},"created_at":"2015-11-25T05:12:12.000Z","updated_at":"2016-02-09T15:51:38.000Z","dependencies_parsed_at":"2023-06-26T00:03:03.963Z","dependency_job_id":null,"html_url":"https://github.com/ccnokes/bogus-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ccnokes/bogus-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccnokes%2Fbogus-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccnokes%2Fbogus-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccnokes%2Fbogus-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccnokes%2Fbogus-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ccnokes","download_url":"https://codeload.github.com/ccnokes/bogus-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccnokes%2Fbogus-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32059736,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T11:35:06.609Z","status":"ssl_error","status_checked_at":"2026-04-20T11:34:48.899Z","response_time":94,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":[],"created_at":"2024-11-17T23:11:36.724Z","updated_at":"2026-04-20T18:31:51.832Z","avatar_url":"https://github.com/ccnokes.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bogus API\n\nA wrapper around the great [json-server](https://github.com/typicode/json-server). It allows you to specify multiple REST resources. Pass in a directory of Javascript files to be required, and they become your REST endpoints.\n\n### Install\n```\nnpm install bogus-api\n```\n\n### Usage\n```javascript\nrequire('bogus-api').create({\n    resourceDir: './my-resources',\n    resourceUriPrefix: '/api/v1',\n}).start();\n```\n\nEach JS file in the `my-resources` directory could look like:\n```javascript\nvar users = [];\n// Create 10 users\nfor (var i = 0; i \u003c 10; i++) {\n    users.push({ id: i, name: 'user' + i });\n}\nmodule.exports = users;\n```\n\nOr it could look like:\n```javascript\nmodule.exports = [\n    { \"id\": 1, \"title\": \"json-server\", \"author\": \"typicode\" },\n    { \"id\": 2, \"title\": \"test\", \"author\": \"ccnokes\" }\n];\n```\nSo you get a little more flexibility than with plain `json-server`.\n\n\nYou can add or override routes using the Express API like so:\n```javascript\nbogusAPI = require('bogus-api');\nvar bogusServer = bogusAPI.create({\n    // These routes will get mounted before the resources are, allowing you to \"short-circuit\" them\n    // This is useful for testing how the UI reacts to error states from an API\n    priorityRoutes: function(server) {\n        // the server arg is an instance of an Express server\n        server.get('/someRoute', function(req, res) {\n            res.status(500).send({ message: 'Some error.' });\n        });\n    }\n}).start();\n```\n\n## Options\n\n| Option            | Description  |\n| ----------------- |--------------|\n| port              | Port the app runs on. 7001 by default. |\n| host              | 0.0.0.0 by default. |\n| resourceUriPrefix | Prefixes all resources with a URI. |\n| resourceDir       | Directory containing your resources. Default to sample-resources. |\n| proxy             | Object containing the host and port of the URL to proxy to. No default. |\n| staticDir         | Path to static directory to serve. |\n| staticUri         | URI to serve static directory through.  |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fccnokes%2Fbogus-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fccnokes%2Fbogus-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fccnokes%2Fbogus-api/lists"}