{"id":16417354,"url":"https://github.com/itsvinayak/mock-crud-api","last_synced_at":"2025-11-17T16:05:10.651Z","repository":{"id":178024251,"uuid":"661262131","full_name":"itsvinayak/mock-crud-api","owner":"itsvinayak","description":"This package allows you to create mock REST API servers for testing and development purposes. It provides a simple and convenient way to define server configurations, handle requests, and send mock responses.","archived":false,"fork":false,"pushed_at":"2023-07-16T12:23:58.000Z","size":1044,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-09T14:15:57.671Z","etag":null,"topics":["api-mocking","api-rest","api-testing","mock","nodejs","testing"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/itsvinayak.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}},"created_at":"2023-07-02T09:49:13.000Z","updated_at":"2023-07-09T16:24:01.000Z","dependencies_parsed_at":"2023-10-17T05:03:16.009Z","dependency_job_id":"477eb874-c1cc-44cc-948d-c20975f08653","html_url":"https://github.com/itsvinayak/mock-crud-api","commit_stats":{"total_commits":41,"total_committers":1,"mean_commits":41.0,"dds":0.0,"last_synced_commit":"91fbe71a12ca4c3caede3054032285e01942c27b"},"previous_names":["itsvinayak/mock-rest-api"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsvinayak%2Fmock-crud-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsvinayak%2Fmock-crud-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsvinayak%2Fmock-crud-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itsvinayak%2Fmock-crud-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/itsvinayak","download_url":"https://codeload.github.com/itsvinayak/mock-crud-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240467085,"owners_count":19805924,"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":["api-mocking","api-rest","api-testing","mock","nodejs","testing"],"created_at":"2024-10-11T07:11:27.647Z","updated_at":"2025-11-17T16:05:10.645Z","avatar_url":"https://github.com/itsvinayak.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mock-crud-api\n\nThis package allows you to create mock REST API servers for testing and development purposes. It provides a simple and convenient way to define server configurations, handle requests, and send mock responses.\n\n![MOCKAPIIMAGE](./image/MockCRUDAPI.png)\n\n![NodeJS](https://img.shields.io/badge/node.js-6DA55F?style=for-the-badge\u0026logo=node.js\u0026logoColor=black)\n\u003ca href='https://www.npmjs.com/package/mock-crud-api'\u003e\n![NPM](https://img.shields.io/badge/NPM-%23CB3837.svg?style=for-the-badge\u0026logo=npm\u0026logoColor=white)\n\u003c/a\u003e\n[![Node.js Lint and Uts](https://github.com/itsvinayak/mock-crud-api/actions/workflows/lint-and-uts.yml/badge.svg)](https://github.com/itsvinayak/mock-crud-api/actions/workflows/lint-and-uts.yml)\n![npm](https://img.shields.io/npm/dw/mock-crud-api)\n![GitHub last commit (branch)](https://img.shields.io/github/last-commit/itsvinayak/mock-crud-api/main)\n\n\n## Features\n\n- Define server configurations with port, path, request type, input, output, and error handling options.\n- Handle HTTP requests.\n- Compare request input with predefined input to determine the response.\n- Customize response outputs and error codes.\n- Parse query strings and extract parameters.\n- Validate and ensure required data fields are present.\n- Start multiple servers simultaneously using a configuration file.\n- Display helpful information and syntax examples.\n\n## Installation\n\nTo install the mock-crud-api package, follow these steps:\n\n- Make sure you have Node.js installed on your machine.\n- Open a terminal or command prompt.\n- Navigate to your project directory.\n- Run the following command to install the package:\n\n```bash\nnpx mock-crud-api --config config.json\n```\n\n```bash\nnpx mock-crud-api -c config.json\n```\n\n## Usage\n\nTo use the mock-crud-api package, follow these steps:\n\n- Create a configuration file (e.g., config.json) with the server configurations.\n\n```JSON\n[\n    {\n        \"name\": \"post-server\",\n        \"method\": \"POST\",\n        \"port\": 3000,\n        \"path\": \"/\",\n        \"input\": {\n            \"method\": \"text\"\n        },\n        \"code\": 200,\n        \"output\": \"text\",\n        \"errorCode\": 500,\n        \"errorMessage\": \"Internal Server Error\"\n    },\n    {\n        \"name\": \"get-server-1\",\n        \"method\": \"GET\",\n        \"port\": 3001,\n        \"path\": \"/test\",\n        \"input\": null,\n        \"code\": 200,\n        \"output\": \"text\"\n    },\n    {\n        \"name\": \"get-server-2\",\n        \"method\": [\"GET\"],\n        \"port\": 3002,\n        \"path\": \"/test\",\n        \"input\": {},\n        \"code\": 201,\n        \"output\": \"text\"\n    },\n    {\n        \"name\": \"patch-server-3\",\n        \"method\": [\"PATCH\", \"PUT\"],\n        \"port\": 3003,\n        \"path\": \"/test\",\n        \"input\": {\n            \"method\": \"json\"\n        },\n        \"code\": 201,\n        \"output\": \"Updated\",\n        \"errorCode\": 500,\n        \"errorMessage\": \"Internal Server Error\"\n    }\n]\n```\n\nIn the configuration file, you can define multiple server configurations. Each configuration object should have the following properties:\n\n- name: The name of the server.\n- type: The HTTP request method (e.g., GET, POST, PUT, DELETE).\n- port: The port number on which the server will listen.\n- path: The API endpoint path for the server.\n- input: The input for which the output is to be generated.\n- code: Code if server found successfully\n- output: The output to be generated for matching requests.\n- errorCode: The error code to be returned if the server is not found.\n- errorMessage: The error message to be returned if the server is not found.\n\n### License ![GitHub](https://img.shields.io/github/license/itsvinayak/mock-crud-api)\nThis package is released under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitsvinayak%2Fmock-crud-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitsvinayak%2Fmock-crud-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitsvinayak%2Fmock-crud-api/lists"}