Mock Servers
Astraio allows you to create mock servers for testing without a real backend.
Creating a Mock
- Open Settings > Mocks
- Click + New Mock
- Configure the mock:
- Name: Descriptive name
- Port: Local port (e.g.,
3001) - Base Path: Optional prefix (e.g.,
/api/v1)
Adding Endpoints
- Open your mock
- Click + Add Endpoint
- Configure:
- Method: GET, POST, etc.
- Path:
/users/:id - Status: 200, 404, etc.
- Response Body: JSON or text
- Headers: Custom response headers
- Delay: Simulate latency (ms)
Path Parameters
Use :param syntax for dynamic segments:
/users/:id/posts/:postIdAccess in response:
{
"user_id": "{{id}}",
"post_id": "{{postId}}"
}Starting a Mock
- Select your mock
- Click Start
- The mock is now listening on the configured port
- Send requests to
http://localhost:<port>
Use Cases
- Frontend development — Mock APIs before backend is ready
- Testing — Simulate error responses
- Prototyping — Quickly test API designs
- Demo — Share mock endpoints with team
Last updated on