# rok-studio

Built-in API testing client for rok. Adds a `StudioLayer` Tower middleware that
serves a TUI testing tab alongside your running server — no separate tool needed.

## Installation

```toml
[dependencies]
rok-studio = { version = "0.1" }
```

## Quick Start

```rust
use rok_studio::{StudioLayer, register_routes, rok_routes};

// Register your routes for Studio to discover
register_routes! [
    (GET,    "/users",     "user::index"),
    (POST,   "/users",     "user::store"),
    (GET,    "/users/:id", "user::show"),
];

let app = rok_routes!(Router::new()
    .route("/users", get(user::index).post(user::store))
    .route("/users/:id", get(user::show))
).layer(StudioLayer::new());
// Studio now serves GET /__studio/routes
```

## TUI Tab (via rok-tui)

Run `rok-tui` with the `studio` feature to get the Studio tab:

```bash
cargo install rok-tui --features studio
rok-tui
```

The Studio tab lets you:
- Browse all registered routes
- Set environment variables with `{{VAR}}` interpolation
- Send HTTP requests and view responses
- Save named collections and view history

## Environment Variables

```
ROK_STUDIO_BASE_URL=http://localhost:3000
ROK_STUDIO_COLLECTION_DIR=.rok-studio/
```
