Skip to content

Examples

Get started with these practical examples to understand how Chimera works and how you can tailor it for your development workflows.

Create a simple data.json mock:

{
"/api/products": [
{ "id": 1, "name": "Laptop", "price": 1200 },
{ "id": 2, "name": "Keyboard", "price": 100 }
]
}
  • Directoryproject/
    • data.json

Run Chimera:

Terminal window
chimera-cli.exe --path data.json

Visit http://localhost:8080/api/products to see the mock response.


Terminal window
chimera-cli.exe --path data.json http

This runs a mock http server


Terminal window
chimera-cli.exe --path data.json websocket

This runs a mock websocket server


Terminal window
chimera-cli.exe --path data.json http --latency 300

This adds a 300ms delay to all responses.


Terminal window
chimera-cli.exe --path data.json http --page 2

Returns 2 results per page.


Terminal window
chimera-cli.exe --path data.json http --sort api/products desc id

Sorts the /api/products endpoint in descending order by attribute id.


Terminal window
chimera-cli.exe --path schema.json http -X

Example schema.json:

{
"routes": [
{
"path": "api/v2/comment",
"no_of_entries": 5,
"schema": {
"id": "id",
"user": "name",
"message": "lorem"
},
"null_percentage": 0
}
]
}

This generates 5 random comments.


Terminal window
chimera-cli.exe --path schema.json http -X --port 4000 --latency 150 --sort api/data asc id

Combines data auto-generation, sorting, and latency as a http mock server on on port 4000.