A CLI tool to create mock APIs.
npm install testapi-cliA CLI tool to create and manage mock API endpoints. It is designed mainly for frontend developers who want a simple way to test their application without setting up a backend server.
---
testapi.json file.--method,--path,--response and --status(status code is optional).testapi.json file. Duplicate entries are prevented.---
bash
npm i testapi-cli
`---
Usage (current stage)
$3
`bash
testapi-cli help
`
$3
`bash
testapi-cli init #creates testapi.json file
`
$3
`bash
testapi-cli add --method GET --path /users --response '[{"id":123,"name":"virat"},{"id":456,"name":"kohli"}]' --status 200
`
- #### Rules:
- --method must be a valid HTTP method.
- --path must begin with '/'.
- --response must be valid JSON enclosed within single quotes.
- --status is optional (default: 200)
$3
`bash
testapi-cli start --port 3000
`
- #### Rules:
- --port must be in the range 1024-65535
$3
`bash
GET http://localhost:3000/users
`
$3
`json
[
{"id":123,"name":"virat"},
{"id":456,"name":"kohli"}
]
`---
Next steps
- Implement delay option for responses.
- Add list and remove` commands.---