InstantMock
InstantMock runs a local HTTP mock server directly inside VS Code using JSON route definitions.
Key Features
- One command to toggle server state:
InstantMock: Toggle Server
- One command to preselect or change mock file:
InstantMock: Select Mock File
- Status bar indicator for ON/OFF state
- Route matching by path and HTTP method
- Configurable response status, JSON body, and delay per route
- Startup port prompt with
3000 prefilled as recommended
- Startup mock-file picker with remembered recommended file path
- CORS headers enabled for local frontend development
Quick Start
- Create a JSON mock config file (for example
mock-api.json in your workspace root).
- Open Command Palette (
Cmd+Shift+P on macOS).
- Run
InstantMock: Toggle Server.
- Choose the mock file:
- Use recommended file (last selected, or workspace
mock-api.json) or browse any local file.
- Confirm or enter the server port (3000 recommended).
- Call your endpoints on
http://localhost:<selected-port>.
Example mock-api.json:
{
"routes": [
{
"path": "/api/health",
"method": "GET",
"status": 200,
"body": {
"status": "ok"
}
}
]
}
Command
InstantMock: Toggle Server
InstantMock: Select Mock File
Setting
instantMock.port: Server port setting (default 3000) available for compatibility.
| |