pub use crate::builder::{EmptyConfig, EmptyState, Gotcha};
pub use crate::config::{ConfigWrapper, GotchaConfigLoader, ServerConfig};
pub use crate::error::{GotchaError, GotchaResult};
pub use crate::router::Responder;
pub use crate::{config, state, GotchaApp, GotchaConfig, GotchaContext, GotchaRouter};
pub use axum::extract::ws::{WebSocket, WebSocketUpgrade};
pub use axum::extract::{Extension, Form, Json, Multipart, Path, Query, State};
pub use axum::extract::{MatchedPath, OriginalUri};
pub use axum::http::{HeaderMap, Method, StatusCode};
pub use axum::middleware;
pub use axum::response::sse::{Event, KeepAlive, Sse};
pub use axum::response::{Html, Redirect, Response};
pub use axum::routing::{delete, get, patch, post, put};
pub use serde::{Deserialize, Serialize};
pub use serde_json::{json, Value as JsonValue};
pub use crate::async_trait;
pub type Result<T, E = Box<dyn std::error::Error + Send + Sync>> = std::result::Result<T, E>;
#[cfg(feature = "openapi")]
pub use crate::{api, Responsible, Schematic};
#[cfg(feature = "cors")]
pub use crate::layers::CorsLayer;
#[cfg(feature = "task")]
pub use crate::TaskScheduler;
#[macro_export]
macro_rules! handler {
($body:expr) => {
|| async move { $body }
};
($param:ident: $param_type:ty => $body:expr) => {
|$param: $param_type| async move { $body }
};
}
#[macro_export]
macro_rules! json_response {
($data:expr) => {
axum::Json(serde_json::json!($data))
};
}
#[macro_export]
macro_rules! quick_server {
(
$(($method:ident, $path:literal, $handler:expr)),* $(,)?
) => {
{
use $crate::prelude::*;
let mut app = Gotcha::new();
$(
app = app.$method($path, $handler);
)*
app
}
};
}
pub use crate::{handler, json_response, quick_server};