Mock API designer
Design endpoints + responses. Export ready-to-use config for Mockoon, Playwright, Postman, or json-server. Pure client-side, zero cost — bring your own runner.
Endpoints
import type { Page } from "@playwright/test";
export async function mockEndpoints(page: Page) {
await page.route("**/api/users", async (route) => {
if (route.request().method() !== "GET") return route.continue();
await route.fulfill({
status: 200,
headers: { "Content-Type": "application/json" },
body: "[{\"id\":1,\"name\":\"Mark\"}]",
});
});
}
// Usage in a test:
// test.beforeEach(async ({ page }) => { await mockEndpoints(page); });
⚠️ This tool does not expose any live endpoint on our server. Take the generated config and run it locally / in CI / on your own infra.
›How to use (this is a designer, not a live mock server)
- Add endpoints on the left: pick method, write path, set status / delay / response body.
- Pick a target format on the right: Playwright / Mockoon / Postman / json-server.
- Right side shows the generated config — hit Copy or Download.
- Take the config to your target tool (see Tips below).
Tips
- Playwright: add the downloaded
.tsto your test project and callawait mockEndpoints(page)inbeforeEach. - Mockoon: Open Mockoon → File → Open environment → choose the downloaded JSON → start it. API serves at
http://localhost:3001. - json-server: in a terminal run
npx json-server db.json→ API athttp://localhost:3000. - Postman: File → Import → choose the collection, then create a mock server inside Postman.
⚠️ To prevent abuse, we do not host live mock endpoints on dev.9niche.com. A hosted mock service would require auth + rate limiting + TTL, planned as Phase 2.
Related tools
- JWT decoder / generatorDecode header / payload / expiry, re-sign with secret
- cURL ↔ fetch ↔ Python converterPaste a cURL command → emit fetch / Python requests / HTTPie
- CSS / XPath selector testerPaste HTML + selector → live highlight of matches
- Regex builder & live testerPattern + sample text → live highlight + capture groups