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:
Peter Meier
2026-06-23 12:44:31 +02:00
commit b122de518c
53 changed files with 2563 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
import type { MockContext } from '../../src/respond.ts'
// Dynamic mock: GET /users/:id -> synthetic user keyed off the id.
export default function ({ params, query, faker }: MockContext) {
faker.seed(Number(params.id) || 1)
return {
status: 200,
body: {
id: params.id,
name: faker.person.fullName(),
email: faker.internet.email(),
city: faker.location.city(),
verbose: query.verbose === '1' ? faker.lorem.paragraph() : undefined,
},
}
}