feat: mockly-hono — file-based mock API server (Hono)
File path = route. JSON/JSON5, dynamic .ts handlers + faker, templating, stateful CRUD (pagination/sort/persist), __variants, sequence, chaos, rate-limit, auth, validation, per-route + global proxy/record, splat routes, X-Scenario overlays, SSE. Visual docs (Scalar) at /__docs from a live OpenAPI 3 spec. OpenAPI import script. Zero-build via tsx. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"feature": "request data — query + headers",
|
||||
"search": "you searched: {{query.q}}",
|
||||
"page": "{{query.page}}",
|
||||
"userAgent": "{{headers.user-agent}}",
|
||||
"tier": "{{headers.x-tier}}",
|
||||
"unresolved": "{{query.missing}} stays literal if absent"
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"title": "faker fields (zero-arg methods, fresh each request)",
|
||||
"person": {
|
||||
"name": "{{faker.person.fullName}}",
|
||||
"firstName": "{{faker.person.firstName}}",
|
||||
"job": "{{faker.person.jobTitle}}"
|
||||
},
|
||||
"internet": {
|
||||
"email": "{{faker.internet.email}}",
|
||||
"username": "{{faker.internet.username}}",
|
||||
"url": "{{faker.internet.url}}"
|
||||
},
|
||||
"location": {
|
||||
"city": "{{faker.location.city}}",
|
||||
"country": "{{faker.location.country}}",
|
||||
"zip": "{{faker.location.zipCode}}"
|
||||
},
|
||||
"ids": {
|
||||
"uuid": "{{faker.string.uuid}}",
|
||||
"int": "{{faker.number.int}}"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"feature": "array of templated objects — each element resolves independently",
|
||||
"users": [
|
||||
{ "id": 1, "name": "{{faker.person.fullName}}", "city": "{{faker.location.city}}" },
|
||||
{ "id": 2, "name": "{{faker.person.fullName}}", "city": "{{faker.location.city}}" },
|
||||
{ "id": 3, "name": "{{faker.person.fullName}}", "city": "{{faker.location.city}}" }
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"feature": "typed vs string",
|
||||
"wholePlaceholder_number": "{{faker.number.int}}",
|
||||
"wholePlaceholder_bool": "{{faker.datatype.boolean}}",
|
||||
"embedded_becomes_string": "lucky: {{faker.number.int}}",
|
||||
"mixed": "{{params.id}}-{{faker.string.alpha}}"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"feature": "path param + faker in plain json (no .ts handler)",
|
||||
"id": "{{params.id}}",
|
||||
"profileUrl": "/users/{{params.id}}",
|
||||
"name": "{{faker.person.fullName}}",
|
||||
"avatar": "{{faker.image.avatar}}"
|
||||
}
|
||||
Reference in New Issue
Block a user