Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
OpenApi
✓ use poem_openapi::OpenApi;
Define an OpenAPI endpoint using Poem.
use poem_openapi::{OpenApi, payload::PlainText};
struct Api;
#[OpenApi]
impl Api {
#[oai(path = "/hello", method = "get")]
async fn hello(&self) -> PlainText<String> {
PlainText("Hello, world!".to_string())
}
}
fn main() {
let api_service = poem_openapi::OpenApiService::new(Api)
.title("My API")
.server("http://localhost:3000");
println!("OpenAPI service created");
}
Upgrade
Version history
5.1.16latest on crates.io
Audit
Dependencies
No dependency data recorded yet.