An open API service indexing awesome lists of open source software.

https://github.com/sonofmagic/mokup

Fast, composable mock tooling
https://github.com/sonofmagic/mokup

hono mock mock-server

Last synced: 4 months ago
JSON representation

Fast, composable mock tooling

Awesome Lists containing this project

README

          


Mokup logo


mokup


File-based mock toolkit for Vite, CLI builds, and runtime usage.



Website ·
Playground ·
GitHub

## Why mokup

- File-based routing via filename suffixes like `users.get.json`.
- JSON/JSONC and TS/JS handlers powered by Hono Context.
- Works in Vite dev, CLI builds (workers), and runtime adapters.
- Built-in headers, status, delays, and middleware hooks.

## Quick start

Create `mock/users.get.json`:

```json
{ "ok": true }
```

Create `mock/login.post.ts`:

```ts
export default async (c) => {
const body = await c.req.json().catch(() => ({}))
return { ok: true, user: body }
}
```

Tip: you can use `defineHandler` for better IntelliSense:

```ts
import { defineHandler } from 'mokup'

export default defineHandler(async (c) => {
const body = await c.req.json().catch(() => ({}))
return { ok: true, user: body }
})
```

Follow the docs at http://mokup.icebreaker.top/ for Vite and CLI setup.

## Contributing

Issues and pull requests are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md).

## Contributors

Thanks to [all contributors](https://github.com/sonofmagic/mokup/graphs/contributors)!

## Authors

ice breaker <1324318532@qq.com>

## License

Distributed under the MIT License. See [LICENSE](LICENSE) for more information.