route.register

Expose new HTTP routes on the daemon router.

When
Registered during init; routes active once HTTP server starts.
Input
Request body bytes for matching method + path.
Output
Response body + status via write_route_response.
Route matching
Exact path per registration. Method must match (GET/POST/PUT/PATCH/DELETE).

Paths must start with `/`. Duplicate method+path registrations fail at init. Plugin routes use the same Bearer auth middleware as the system API.

Pipeline

Plugin routes merge into the main Axum router alongside core API routes.

Use cases

  • Custom webhooks and panel callbacks
  • Plugin-specific REST APIs without forking FeatherFly
  • Static JSON config endpoints for operators

Example

Registration and handler

Register

route!(host, HTTP_METHOD_GET, "/plugins/hello", on_hello);

Handler

extern "C" fn on_hello(ctx: *const RouteHandlerContext) -> i32 {
    let ctx = unsafe { &*ctx };
    write_route_response(ctx, 200, br#"{"plugin":"hello"}"#)
}

← Back to index