{"id":15551579,"url":"https://github.com/bahmutov/parcel-json-server","last_synced_at":"2025-06-16T21:40:16.587Z","repository":{"id":40570557,"uuid":"189018568","full_name":"bahmutov/parcel-json-server","owner":"bahmutov","description":"Combination of ParcelJs bundler and json-server","archived":false,"fork":false,"pushed_at":"2024-10-19T04:05:40.000Z","size":697,"stargazers_count":6,"open_issues_count":5,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-23T04:25:57.708Z","etag":null,"topics":["json-server","parcel-bundler"],"latest_commit_sha":null,"homepage":null,"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/bahmutov.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-05-28T11:51:42.000Z","updated_at":"2024-09-07T14:03:04.000Z","dependencies_parsed_at":"2023-09-30T05:38:22.284Z","dependency_job_id":"e5a1546c-d52b-4bc2-b2c2-a86e439b300b","html_url":"https://github.com/bahmutov/parcel-json-server","commit_stats":{"total_commits":80,"total_committers":3,"mean_commits":"26.666666666666668","dds":0.275,"last_synced_commit":"3677cb596169b55db1b28aca5970a594b9f9a41d"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahmutov%2Fparcel-json-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahmutov%2Fparcel-json-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahmutov%2Fparcel-json-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahmutov%2Fparcel-json-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bahmutov","download_url":"https://codeload.github.com/bahmutov/parcel-json-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234570390,"owners_count":18854156,"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":["json-server","parcel-bundler"],"created_at":"2024-10-02T14:05:33.948Z","updated_at":"2025-01-18T22:17:25.908Z","avatar_url":"https://github.com/bahmutov.png","language":"JavaScript","readme":"# @bahmutov/parcel-json-server\n\n\u003e Combination of [ParcelJs bundler][parcel] and [json-server][json-server]\n\n[![NPM][npm-icon] ][npm-url]\n\n[![CircleCI](https://circleci.com/gh/bahmutov/parcel-json-server.svg?style=svg)](https://circleci.com/gh/bahmutov/parcel-json-server)\n[![semantic-release][semantic-image] ][semantic-url]\n[![renovate-app badge][renovate-badge]][renovate-app]\n\n## Install\n\nRequires Node 10+ because of ParcelJS bundler\n\n```shell\nnpm i -D @bahmutov/parcel-json-server\n```\n\n## Use\n\n- create a JSON file to server as a database / REST api, see [json-server][json-server] documentation. For example see [test/data.json](test/data.json)\n- have an HTML with JavaScript, CSS, etc. for [Parcel][parcel] bundler to process and serve, for example see [test/app/index.html](test/app/index.html)\n- run `parcel-json-server --entrypoint \u003cpath to HTML file\u003e --database \u003cpath to JSON file\u003e` and get the app running at `localhost:\u003cport\u003e` with REST endpoints at `localhost:\u003cport\u003e/\u003cresource name\u003e`\n\n### Options\n\n```text\n$ node ./src/cli.js --help\n  Usage: cli.js [options] [command]\n\n  Commands:\n    help     Display help\n    version  Display version\n\n  Options:\n    -d, --database    database JSON filename\n    -e, --entrypoint  HTML filename to serve\n    -h, --help        Output usage information\n    -p, --port \u003cn\u003e    Port to run on (defaults to 3000)\n    -v, --version     Output the version number\n```\n\n### Example\n\nIn this repo the example `npm start` script runs\n\n```\n$ @bahmutov/parcel-json-server \\\n    --port 3000 \\\n    --entrypoint test/app/index.html \\\n    --database test/data.json\n```\n\nThen I can open `localhost:3000` and see the application, and make calls to `localhost:3000/todos` (full REST endpoint)\n\nTo reset data, use `POST /reset` request, pass new data to overwrite ALL old data.\nFor example, from a Cypress test [cypress/integration/spec.js](cypress/integration/spec.js) you can do the following\n\n```js\nconst todos = require('../../test/data.json').todos\n\nit('responds from REST API', () =\u003e {\n  cy.request('POST', '/reset', { todos })\n  cy.request('/todos')\n    .its('body')\n    .should('deep.equal', todos)\n})\n```\n\n### Debugging\n\nIf you want to see debug messages, run with environment variable\n\n```\nDEBUG=@bahmutov/parcel-json-server\n```\n\n### Small print\n\nAuthor: Gleb Bahmutov \u0026lt;gleb.bahmutov@gmail.com\u0026gt; \u0026copy; 2019\n\n* [@bahmutov](https://twitter.com/bahmutov)\n* [glebbahmutov.com](https://glebbahmutov.com)\n* [blog](https://glebbahmutov.com/blog)\n\nLicense: MIT - do anything with the code, but don't blame me if it does not work.\n\nSupport: if you find any problems with this module, email / tweet /\n[open issue](https://github.com/bahmutov/parcel-json-server/issues) on Github\n\n## MIT License\n\nCopyright (c) 2019 Gleb Bahmutov \u0026lt;gleb.bahmutov@gmail.com\u0026gt;\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n\n[npm-icon]: https://nodei.co/npm/@bahmutov/parcel-json-server.svg?downloads=true\n[npm-url]: https://npmjs.org/package/@bahmutov/parcel-json-server\n[semantic-image]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg\n[semantic-url]: https://github.com/semantic-release/semantic-release\n[renovate-badge]: https://img.shields.io/badge/renovate-app-blue.svg\n[renovate-app]: https://renovateapp.com/\n\n[parcel]: https://parceljs.org\n[json-server]: https://github.com/typicode/json-server\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbahmutov%2Fparcel-json-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbahmutov%2Fparcel-json-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbahmutov%2Fparcel-json-server/lists"}