https://github.com/nicobistolfi/mockthis-cli
MockThis is a command-line interface (CLI) tool for managing mock API endpoints. It allows users to create, update, delete, and list mock endpoints for testing and development purposes.
https://github.com/nicobistolfi/mockthis-cli
golang mock-api mock-server
Last synced: 9 days ago
JSON representation
MockThis is a command-line interface (CLI) tool for managing mock API endpoints. It allows users to create, update, delete, and list mock endpoints for testing and development purposes.
- Host: GitHub
- URL: https://github.com/nicobistolfi/mockthis-cli
- Owner: nicobistolfi
- License: mit
- Created: 2024-09-08T04:32:13.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-13T01:12:31.000Z (10 months ago)
- Last Synced: 2025-03-23T21:35:44.598Z (10 months ago)
- Topics: golang, mock-api, mock-server
- Language: Go
- Homepage: https://mockthis.io
- Size: 110 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MockThis CLI

[](https://pkg.go.dev/github.com/nicobistolfi/mockthis-cli)
[](https://goreportcard.com/report/github.com/nicobistolfi/mockthis-cli)
[](https://docs.mockthis.io/)

[](https://github.com/nicobistolfi)


MockThis is a command-line interface (CLI) tool for managing publicly available mock API endpoints. It allows users to create, update, delete, and list mock endpoints for testing and development purposes.
## Key Features
- User authentication (login and registration)
- Create new mock endpoints
- Delete endpoints
- List all created endpoints
- Get details of specific endpoints
## Installation
### macOS
To install MockThis on macOS using Homebrew, follow these steps:
1. First, tap the repository:
```
brew tap nicobistolfi/carbon
```
2. Then, install MockThis:
```
brew install mockthis
```
## Usage
The general syntax for using MockThis is:
```
mockthis [command] [flags]
```
### Available Commands
- `create`: Create a new mock endpoint
- `delete`: Remove an endpoint
- `list`: Display all created endpoints
- `get`: Retrieve details of a specific endpoint
- `login`: Authenticate user
- `register`: Create a new user account
- `completion`: Generate shell autocompletion scripts
For detailed information on each command, use:
```
mockthis [command] --help
```
### Registering a new user
To register a new user account, use the register command. You can provide your email as an argument or enter it when prompted.
```
mockthis register
```
### Logging in
To log in to MockThis, use the login command. You can either provide your email as an argument or enter it when prompted.
```
mockthis login {email}
```
If you don't provide an email, you will be prompted to enter it.
### Creating a new endpoint
To create a new mock endpoint, use the create command. You can provide the endpoint details as arguments or enter them when prompted.
```
mockthis create -m GET -s 200 -b '{"message": "Hello, World!"}'
```
Comand line output will include the endpoint details, such as the method, status, body, and path.
```
Endpoint created successfully!
Mock URL: https://api.mockthis.io/m/c35f0f6-af9d-4976-8ff9-d45e1dee8832
| Field | Value |
+---------------------+--------------------------------------+
| ID | c35f0f6-af9d-4976-8ff9-d45e1dee8832 |
| Method | GET |
| Status | 200 |
| ResponseContentType | application/json |
| ResponseBody | {"message": "Hello, World!"} |
| CreatedAt | 2024-09-17T02:29:45Z |
| Charset | UTF-8 |
```
## Roadmap
The roadmap may change witouth notice.
- Include JSON schema and validate schema for endpoint creation using `—file`
- Enable `mockthis update` to update already existing endpoints
- Update `mockthis get` to use the get endpoint instead of list
- Allow the use of `—schema` to ensure the response body matches the schema
- Allow the use of `—request-schema` to ensure the request body matches the schema
- Implement header `X-Mock-Dynamic: true` in the request and use the schema to generate a dynamic response