1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
//! Poem is a full-featured and easy-to-use web framework with the Rust
//! programming language.
//!
//! # Usage
//!
//! Depend on poem in Cargo.toml:
//!
//! ```toml
//! poem = "*"
//! ```
//!
//! # Example
//!
//! ```no_run
//! use poem::{get, handler, listener::TcpListener, web::Path, Route, Server};
//!
//! #[handler]
//! fn hello(Path(name): Path<String>) -> String {
//! format!("hello: {}", name)
//! }
//!
//! #[tokio::main]
//! async fn main() -> Result<(), std::io::Error> {
//! let app = Route::new().at("/hello/:name", get(hello));
//! let listener = TcpListener::bind("127.0.0.1:3000");
//! let server = Server::new(listener).await?;
//! server.run(app).await
//! }
//! ```
//!
//! # Crate features
//!
//! To avoid compiling unused dependencies, Poem gates certain features, all of
//! which are disabled by default:
//!
//! |Feature |Description |
//! |------------------|--------------------------------|
//! |cookie | Support for Cookie |
//! |websocket | Support for WebSocket |
//! |multipart | Support for Multipart |
//! |sse | Support Server-Sent Events (SSE) |
//! |tls | Support for HTTP server over TLS |
//! |tempfile | Support for [`tempfile`](https://crates.io/crates/tempfile) |
//! |tower-compat | Adapters for `tower::Layer` and `tower::Service`. |
#![doc(html_favicon_url = "https://poem.rs/assets/favicon.ico")]
#![doc(html_logo_url = "https://poem.rs/assets/logo.png")]
#![forbid(unsafe_code)]
#![deny(private_in_public, unreachable_pub)]
#![cfg_attr(docsrs, feature(doc_cfg))]
#![warn(missing_docs)]
pub mod endpoint;
pub mod error;
pub mod listener;
pub mod middleware;
pub mod service;
pub mod web;
#[doc(inline)]
pub use http;
mod body;
mod request;
mod response;
mod route;
mod server;
pub use async_trait::async_trait;
pub use body::Body;
pub use endpoint::{Endpoint, EndpointExt, IntoEndpoint};
pub use error::{Error, Result};
pub use middleware::Middleware;
pub use poem_derive::handler;
pub use request::{Request, RequestBuilder, RequestParts};
pub use response::{Response, ResponseBuilder, ResponseParts};
pub use route::{connect, delete, get, head, options, patch, post, put, trace, Route, RouteMethod};
pub use server::{warps_endpoint, Server};
pub use web::{FromRequest, IntoResponse, RequestBody};