mod body;
#[cfg(feature = "download")]
mod download;
mod error;
mod fs;
mod handler;
mod middleware;
#[cfg(feature = "multipart")]
mod multipart;
mod regex;
mod request;
mod responder;
mod response;
mod router;
#[cfg(feature = "rustls")]
#[allow(dead_code)]
mod rustls;
mod serde_request;
mod server;
#[cfg(feature = "static_file")]
mod static_dir;
mod tokio_io;
#[cfg(feature = "websocket")]
mod ws;
pub use async_trait::async_trait;
pub use fs::{NamedFile, NamedFileBuilder};
pub use futures;
pub use handler::Handler;
pub use headers;
pub use middleware::Middleware;
pub use router::Controller;
pub use serde_json;
pub use serde_urlencoded;
pub use thiserror;
pub type Result<T = response::Response, E = error::Error> = std::result::Result<T, E>;
pub mod prelude {
#[cfg(feature = "download")]
pub use crate::download::DispositionType;
#[cfg(feature = "rustls")]
pub use crate::rustls::RustlsConfig;
#[cfg(feature = "static_file")]
pub use crate::static_dir::StaticDir;
#[cfg(feature = "websocket")]
pub use crate::ws::{new_ws, WebSocket};
pub use crate::{
error::Error,
middleware::Next,
request::Request,
responder::{Form, Json, Query, Responder, Text},
response::Response,
router::Router,
Result,
};
#[cfg(feature = "cookie")]
pub use cookie::{Cookie, CookieJar};
pub use hypers_macro::{controller, middleware};
pub use serde::{Deserialize, Serialize};
pub use serde_json::json;
#[cfg(feature = "native_tls")]
pub use tokio_native_tls::native_tls::Identity as NativeTls;
#[cfg(feature = "websocket")]
pub use tokio_tungstenite::tungstenite::Message;
#[cfg(feature = "validate")]
pub use validator::Validate;
}
#[must_use = "Please use this function to create an HTTP service!"]
#[inline]
pub fn new(handler: impl handler::Handler) -> server::Server {
server::Server {
handler: std::sync::Arc::new(handler),
addr: None,
}
}