folk-plugin-http
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
Configuration
[]
= "0.0.0.0:8080"
| Key | Type | Default | Description |
|---|---|---|---|
listen |
SocketAddr |
"0.0.0.0:8080" |
Address and port to bind |
How it works
- 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.
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:
[[]]
= "folk-plugin-http"
= "0.2"
= "http"
Configure in folk.toml:
[]
= "0.0.0.0:8080"
Build and run:
Requirements
- Rust 1.88+
- folk-api 0.2
License
MIT