go-mokapi 0.14.6 → 0.14.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<
|
|
2
|
+
<a href="https://mokapi.io">
|
|
3
|
+
<img src="https://raw.githubusercontent.com/marle3003/mokapi/refs/heads/main/logo.svg" alt="Mokapi" title="Mokapi" width="300" />
|
|
4
|
+
</a>
|
|
3
5
|
</p>
|
|
4
6
|
|
|
5
7
|
<h3 align="center">Your API Mocking Tool for Agile Development</h3>
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
to create and test API designs before actually building them.
|
|
9
|
+
# 🚀 Overview
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
Mokapi is an open-source tool that helps Agile, DevOps, and Continuous
|
|
12
|
+
Deployment teams design, test, and validate APIs before implementation.
|
|
13
|
+
It enables rapid prototyping of scenarios—like delayed responses,
|
|
14
|
+
failures, or edge cases—without needing a live backend. By simulating
|
|
15
|
+
real-world conditions early, Mokapi improves API quality and reduces
|
|
16
|
+
the risk of bugs in production.
|
|
13
17
|
|
|
14
|
-
|
|
15
|
-
reduces the risk of bugs or errors in production.
|
|
16
|
-
|
|
17
|
-
Its core feature are:
|
|
18
|
+
# ✨ Features
|
|
18
19
|
|
|
19
20
|
- **Multiple Protocol support**: HTTP, HTTPS, Apache Kafka, SMTP, LDAP
|
|
20
21
|
- **Everything as Code**: Reusing, version control, consistency and integrate mocks with your CI/CD.
|
|
@@ -23,33 +24,102 @@ Its core feature are:
|
|
|
23
24
|
- **Multiple Provider support**: File, HTTP, GIT, NPM to gather configurations and scripts.
|
|
24
25
|
- **Dashboard** to see what's going on.
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
<p align="center">
|
|
28
|
-
<a href="https://www.buymeacoffee.com/mokapi" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" ></a>
|
|
29
|
-
<p align="center">
|
|
27
|
+
## 🔧 Spin Up Mokapi
|
|
30
28
|
|
|
29
|
+
Install and start Mokapi using one of the following methods.
|
|
30
|
+
Replace the URL with your own OpenAPI or AsyncAPI specification.
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
Windows
|
|
33
|
+
```shell
|
|
34
|
+
choco install mokapi
|
|
35
|
+
mokapi https://petstore31.swagger.io/api/v31/openapi.json
|
|
36
|
+
```
|
|
33
37
|
|
|
34
|
-
|
|
38
|
+
MacOS
|
|
39
|
+
```shell
|
|
40
|
+
brew tap marle3003/tap
|
|
41
|
+
brew install mokapi
|
|
42
|
+
mokapi https://petstore31.swagger.io/api/v31/openapi.json
|
|
43
|
+
```
|
|
35
44
|
|
|
36
|
-
|
|
45
|
+
Docker
|
|
46
|
+
```shell
|
|
47
|
+
docker run -p 80:80 -p 8080:8080 mokapi/mokapi:latest https://petstore31.swagger.io/api/v31/openapi.json
|
|
48
|
+
```
|
|
37
49
|
|
|
38
|
-
|
|
50
|
+
# 🎯 Hit Your First Mock
|
|
51
|
+
Once Mokapi is running, you can make requests to your mocked API like so:
|
|
52
|
+
```shell
|
|
53
|
+
curl http://localhost/api/v31/pet/2 -H 'Accept: application/json'
|
|
54
|
+
```
|
|
39
55
|
|
|
40
|
-
|
|
56
|
+
# 🧩 Customize Your Mock with JavaScript
|
|
41
57
|
|
|
42
|
-
|
|
43
|
-
|
|
58
|
+
Mokapi makes it simple to control responses using embedded JavaScript.
|
|
59
|
+
|
|
60
|
+
For example, you can dynamically change the response based on query parameters or headers:
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
import { on } from 'mokapi';
|
|
64
|
+
|
|
65
|
+
export default function() {
|
|
66
|
+
on('http', (request, response): boolean => {
|
|
67
|
+
switch (request.path.petId) {
|
|
68
|
+
case 2:
|
|
69
|
+
response.data.name = 'Betty';
|
|
70
|
+
return true;
|
|
71
|
+
case 9:
|
|
72
|
+
response.statusCode = 404;
|
|
73
|
+
}
|
|
74
|
+
return false;
|
|
75
|
+
});
|
|
76
|
+
}
|
|
44
77
|
```
|
|
45
78
|
|
|
46
|
-
|
|
79
|
+
# 🖥️ Dashboard
|
|
80
|
+
|
|
81
|
+
Mokapi’s dashboard lets you visualize your mock APIs. View requests and responses in real-time, generate and validate sample data for testing.
|
|
82
|
+
|
|
83
|
+
<img src="https://raw.githubusercontent.com/marle3003/mokapi/refs/heads/main/webui.png" alt="Mokapi Web UI" title="Mokapi Web UI" />
|
|
84
|
+
|
|
85
|
+
# 🧪 Learn by Example
|
|
86
|
+
|
|
87
|
+
Explore tutorials that walk you through mocking different protocols and scenarios:
|
|
88
|
+
|
|
89
|
+
- 🌍 [Get started with REST API](https://mokapi.io/docs/resources/tutorials/get-started-with-rest-api)\
|
|
90
|
+
This tutorial will show you how to mock a REST API using an OpenAPI specification.
|
|
91
|
+
|
|
92
|
+
- ⚡ [Mocking Kafka with AsyncAPI](https://mokapi.io/docs/resources/tutorials/get-started-with-kafka)\
|
|
93
|
+
mocking a Kafka topic using Mokapi and verifying that a producer generates valid messages.
|
|
94
|
+
|
|
95
|
+
- 👨💻 [Mocking LDAP Authentication](https://mokapi.io/docs/resources/tutorials/mock-ldap-authentication-in-node)\
|
|
96
|
+
Simulate LDAP-based login flows, including group-based permissions.
|
|
97
|
+
|
|
98
|
+
- 📧 [Mocking SMTP Mail Servers](https://mokapi.io/docs/resources/tutorials/mock-smtp-server-send-mail-using-node)\
|
|
99
|
+
Use Mokapi to simulate sending and receiving emails in Node.js apps.
|
|
100
|
+
|
|
101
|
+
- 🖥️ [End-to-End Testing with Jest and GitHub Actions](https://mokapi.io/docs/resources/tutorials/running-mokapi-in-a-ci-cd-pipeline)\
|
|
102
|
+
Integrate Mokapi into your CI pipeline for full-stack E2E testing.
|
|
103
|
+
|
|
104
|
+
> More examples are available on [mokapi.io/docs/resources](https://mokapi.io/docs/resources)
|
|
105
|
+
|
|
106
|
+
# 📚 Documentation
|
|
47
107
|
|
|
48
108
|
- [Get Started](https://mokapi.io/docs/guides/welcome)
|
|
49
|
-
- [HTTP](https://mokapi.io/docs/guides/http
|
|
109
|
+
- [HTTP](https://mokapi.io/docs/guides/http)
|
|
50
110
|
- [Kafka](https://mokapi.io/docs/guides/kafka/overview)
|
|
51
111
|
- [LDAP](https://mokapi.io/docs/guides/ldap/overview)
|
|
52
112
|
- [SMTP](https://mokapi.io/docs/guides/smtp/overview)
|
|
53
113
|
- [Javascript API](https://mokapi.io/docs/javascript-api)
|
|
54
|
-
- [Examples & Tutorials](https://mokapi.io/docs/
|
|
55
|
-
- [Blogs](https://mokapi.io/docs/blogs)
|
|
114
|
+
- [Examples & Tutorials](https://mokapi.io/docs/resources)
|
|
115
|
+
- [Blogs](https://mokapi.io/docs/blogs)
|
|
116
|
+
|
|
117
|
+
# ☕ Support
|
|
118
|
+
|
|
119
|
+
If you find Mokapi helpful, consider supporting the project:
|
|
120
|
+
|
|
121
|
+
<a href="https://www.buymeacoffee.com/mokapi" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" ></a>
|
|
122
|
+
|
|
123
|
+
# 📄 License
|
|
124
|
+
|
|
125
|
+
This project is licensed under the MIT License. See the [LICENSE](https://github.com/marle3003/mokapi/blob/main/LICENSE) file for details.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|