folk-plugin-http 0.2.0

HTTP plugin for Folk — accepts connections via hyper and dispatches to PHP workers
Documentation
# folk-plugin-http

HTTP plugin for Folk. Built on [axum](https://github.com/tokio-rs/axum) (hyper + tokio). Dispatches incoming HTTP requests to PHP workers via `execute_value` for zero-copy dispatch.

**Version:** 0.2.0

## Configuration

```toml
[http]
listen = "0.0.0.0:8080"
```

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| `listen` | `SocketAddr` | `"0.0.0.0:8080"` | Address and port to bind |

## How it works

1. Incoming HTTP request arrives via axum.
2. Request (method, URI, headers, body) is converted to a `serde_json::Value`.
3. Dispatched to a PHP worker via `executor.execute_value()` -- zero-copy, no JSON encode/decode.
4. Worker returns a response value (status, headers, body), converted back to an HTTP response.

Error mapping: worker error -> `502`, internal failure -> `500`.

## Graceful shutdown

The plugin listens on `ctx.shutdown`. On signal, it stops accepting new connections and drains in-flight requests before exiting.

## Quick start

Add the plugin to `folk.build.toml`:

```toml
[[plugin]]
crate_name = "folk-plugin-http"
version = "0.2"
config_key = "http"
```

Configure in `folk.toml`:

```toml
[http]
listen = "0.0.0.0:8080"
```

Build and run:

```bash
folk-builder build
./my-folk serve
curl http://localhost:8080/
```

## Requirements

- Rust 1.88+
- [folk-api]https://github.com/Folk-Project/folk-api 0.2

## License

MIT