{"id":13391747,"url":"https://github.com/meeshkan/micro-jaymock","last_synced_at":"2025-03-13T16:31:24.352Z","repository":{"id":37832914,"uuid":"221584215","full_name":"meeshkan/micro-jaymock","owner":"meeshkan","description":"Tiny API mocking microservice for generating fake JSON data.","archived":true,"fork":false,"pushed_at":"2022-06-25T09:24:44.000Z","size":9533,"stargazers_count":133,"open_issues_count":5,"forks_count":7,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-11-14T05:33:41.827Z","etag":null,"topics":["data","fake","fake-data","micro","microservice","test-data","testing"],"latest_commit_sha":null,"homepage":"https://jaymock.now.sh","language":"TypeScript","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/meeshkan.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":"2019-11-14T01:22:39.000Z","updated_at":"2024-10-21T22:24:37.000Z","dependencies_parsed_at":"2022-08-19T10:11:15.971Z","dependency_job_id":null,"html_url":"https://github.com/meeshkan/micro-jaymock","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meeshkan%2Fmicro-jaymock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meeshkan%2Fmicro-jaymock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meeshkan%2Fmicro-jaymock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meeshkan%2Fmicro-jaymock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/meeshkan","download_url":"https://codeload.github.com/meeshkan/micro-jaymock/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243441361,"owners_count":20291454,"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":["data","fake","fake-data","micro","microservice","test-data","testing"],"created_at":"2024-07-30T15:01:08.724Z","updated_at":"2025-03-13T16:31:23.535Z","avatar_url":"https://github.com/meeshkan.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# micro-jaymock\n\n[![CircleCI](https://img.shields.io/circleci/build/github/meeshkan/micro-jaymock?style=for-the-badge)](https://circleci.com/gh/Meeshkan/micro-jaymock) [![XO](https://img.shields.io/badge/code_style-XO-5ed9c7.svg?style=for-the-badge)](https://github.com/xojs/xo) [![Codecov](https://img.shields.io/codecov/c/github/Meeshkan/micro-jaymock?style=for-the-badge)](https://codecov.io/gh/Meeshkan/micro-jaymock)\n\n\u003e Tiny API mocking microservice for generating fake JSON data.\n\n\u003cimg src=\"demo.gif\" width=\"800\"\u003e\n\n## Usage\n\n- Send a `POST` request to [`https://jaymock.now.sh/`](https://jaymock.now.sh) (or [`https://micro-jaymock.now.sh/`](https://micro-jaymock.now.sh)) with your JSON template (see [`jaymock.populate`'s `template` parameter](https://github.com/Meeshkan/jaymock#populatetemplate)) as your request's `body`.\n\n### Examples\n\n#### Using `curl`:\n```bash\n~ ❯❯❯ curl -X POST \\\n        -d '{ \"firstName\": \"name.firstName\", \"lastName\": \"name.lastName\" }' \\\n        https://jaymock.now.sh\n{\"firstName\":\"Isaac\",\"lastName\":\"Schultz\"}\n```\n\n#### Using [`httpie`](https://github.com/jakubroztocil/httpie):\n```bash\n~ ❯❯❯ http -b POST https://jaymock.now.sh \\\n        firstName=name.firstName lastName=name.lastName ssn=chance.ssn \\\n        _repeat:=3\n[\n    {\n        \"firstName\": \"Jalyn\",\n        \"lastName\": \"Weimann\",\n        \"ssn\": \"493-64-4894\"\n    },\n    {\n        \"firstName\": \"Alvah\",\n        \"lastName\": \"Ziemann\",\n        \"ssn\": \"567-92-8024\"\n    },\n    {\n        \"firstName\": \"Bennett\",\n        \"lastName\": \"Russel\",\n        \"ssn\": \"356-24-9256\"\n    }\n]\n```\n\n#### Using [`request`](https://github.com/request/request) (Node.js):\n```js\nconst request = require('request')\nconst template = {\n\tfirstName: 'name.firstName',\n\tlastName: 'name.lastName',\n\tipAddresses: 'internet.ip|2'\n}\nrequest.post({url: 'https://jaymock.now.sh', json: template}, (error, response, body) =\u003e {\n    if (error) {\n        /* Handle error */\n        console.error(error)\n    }\n    console.log(body)\n    /*\n        {\n            firstName: 'Kaley',\n            lastName: 'Muller',\n            ipAddresses: [ '118.171.253.32', '193.234.186.225' ]\n        }\n    */\n})\n```\n\n#### Using [`got`](https://github.com/sindresorhus/got) (Node.js):\n```js\nconst got = require('got');\nconst template = {\n    name: 'fake({{name.lastName}}, {{name.firstName}} {{name.suffix}})',\n    ssn: 'chance.ssn',\n    knownAddresses: {\n        street: 'address.streetAddress',\n        city: 'address.city',\n        zipCode: 'address.zipCode',\n        _repeat: 2\n    }\n};\n(async () =\u003e {\n    const {body} = await got.post('https://jaymock.now.sh', {\n        json: template,\n        responseType: 'json'\n    });\n    console.log(body);\n    /*\n        {\n            name: 'Goodwin, Libby II',\n            ssn: '368-52-3834',\n            knownAddresses: [\n                {\n                    street: '42483 Citlalli Viaduct',\n                    city: 'West Joeybury',\n                    zipCode: '43966-8850'\n                },\n                {\n                    street: '36297 Estella Throughway',\n                    city: 'South Claudie',\n                    zipCode: '39189-1653'\n                }\n            ]\n        }\n    */\n})();\n```\n\n#### Using [`requests`](https://github.com/psf/requests) (Python 3):\n```py\nimport requests, json\ntemplate = {\n\t\"accounts\": {\n\t\t\"name\": \"finance.accountName\",\n\t\t\"iban\": \"finance.iban\",\n\t\t\"bic\": \"finance.bic\",\n\t\t\"currentBalance\": \"finance.amount\",\n\t\t\"currency\": \"finance.currencyName\",\n\t\t\"_repeat\": 2\n\t}\n}\nr = requests.post('https://jaymock.now.sh', data = json.dumps(template))\nparsedFakeData = json.loads(r.text) # parse for pretty-printing\nprint(json.dumps(parsedFakeData, indent=4, sort_keys=True))\n\"\"\"\n\t{\n\t\t\"accounts\": [\n\t\t\t{\n\t\t\t\t\"bic\": \"WNRUMKJ1\",\n\t\t\t\t\"currency\": \"Turkish Lira\",\n\t\t\t\t\"currentBalance\": \"37.49\",\n\t\t\t\t\"iban\": \"CY70805008804937709053145O66\",\n\t\t\t\t\"name\": \"Credit Card Account\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"bic\": \"LTJUMXQ1\",\n\t\t\t\t\"currency\": \"Somoni\",\n\t\t\t\t\"currentBalance\": \"98.10\",\n\t\t\t\t\"iban\": \"FI1000486540190178\",\n\t\t\t\t\"name\": \"Home Loan Account\"\n\t\t\t}\n\t\t]\n\t}\n\"\"\"\n```\n\n## Development\n\nFirst, clone the repository and install its dependencies:\n```bash\n~ ❯❯❯ git clone https://github.com/Meeshkan/micro-jaymock.git\n~ ❯❯❯ cd micro-jaymock/\n~/micro-jaymock ❯❯❯ npm install\n```\n\nSubsequently, start the development server:\n```bash\n~/micro-jaymock ❯❯❯ npm run dev\n```\nYou can then access the service by navigating to [`localhost:3000`](http://localhost:3000).\n\nAlternatively, you can download [`jaymock-cli`](https://github.com/Meeshkan/jaymock-cli) (by running `~ ❯❯❯ npm i -g jaymock-cli`), which allows you to run the development server and, consequently, mock a fake API 'globally' (by simply executing `~ ❯❯❯ jaymock --server`).\n\n## Deployment\n\n[![Deploy to now](https://deploy.now.sh/static/button.svg)](https://deploy.now.sh/?repo=https://github.com/Meeshkan/micro-jaymock)\n\nAlternatively, to deploy `micro-jaymock` manually:\n\nFirst, [download `now`](https://zeit.co/download):\n```bash\n~ ❯❯❯ npm install -g now\n```\n\nThen, run `now` from *within* the `micro-jaymock` directory:\n```bash\n~/micro-jaymock ❯❯❯ now\n```\n\n## Related\n\n- [jaymock](https://github.com/Meeshkan/jaymock) - API for this module\n- [jaymock-cli](https://github.com/Meeshkan/jaymock-cli) - Mock an API and generate fake JSON test data, right from the terminal\n\n## Contributing\n\nThanks for wanting to contribute! We will soon have a contributing page\ndetailing how to contribute. Meanwhile, feel free to star this repository, open issues,\nand ask for more features and support.\n\nPlease note that this project is governed by the [Meeshkan Community Code of Conduct](https://github.com/meeshkan/code-of-conduct). By participating in this project, you agree to abide by its terms.\n\n## Credits\n\n- [`Faker.js`](https://github.com/Marak/Faker.js) is used as [`jaymock`](https://github.com/Meeshkan/jaymock)'s core fake data generator.\n- [`chance`](https://github.com/chancejs/chancejs) is imported as a fake data generator dependency (using [`jaymock.extend`](https://github.com/Meeshkan/jaymock#extendname-body)).\n- [`micro`](https://github.com/zeit/micro) is used to serve this HTTP microservice.\n\n## License\n\nMIT © [Meeshkan](http://meeshkan.com/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeeshkan%2Fmicro-jaymock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmeeshkan%2Fmicro-jaymock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeeshkan%2Fmicro-jaymock/lists"}