HTTP plugin for Folk. Built on axum (hyper + tokio). Dispatches incoming HTTP requests to PHP workers via execute_value for zero-copy dispatch.
Version: 0.2.0
[http]
listen = "0.0.0.0:8080"| Key | Type | Default | Description |
|---|---|---|---|
listen |
SocketAddr |
"0.0.0.0:8080" |
Address and port to bind |
- Incoming HTTP request arrives via axum.
- Request (method, URI, headers, body) is converted to a
serde_json::Value. - Dispatched to a PHP worker via
executor.execute_value()-- zero-copy, no JSON encode/decode. - Worker returns a response value (status, headers, body), converted back to an HTTP response.
Error mapping: worker error -> 502, internal failure -> 500.
The plugin listens on ctx.shutdown. On signal, it stops accepting new connections and drains in-flight requests before exiting.
Add the plugin to folk.build.toml:
[[plugin]]
crate_name = "folk-plugin-http"
version = "0.2"
config_key = "http"Configure in folk.toml:
[http]
listen = "0.0.0.0:8080"Build and run:
folk-builder build
./my-folk serve
curl http://localhost:8080/- Rust 1.88+
- folk-api 0.2
MIT