Skip to content
/ gotcha Public

full featured web framework written by rust

Notifications You must be signed in to change notification settings

Kilerd/gotcha

Repository files navigation

gotcha

provide a featured web framework

aim to

  • everything of axum
  • automatically swagger api generation
  • built-in message mechanism
  • environment based configuration system, support environment resolver ${ANY_ENV_VAR} and path variable ${app.database.name} powered by yaac
  • logging system
  • opt-in prometheus integration
  • sqlx based magic ORM
  • cron-based task system

get started

add dependency into Cargo.toml

gotcha = {version = "0.1"}
tokio = {version = "1", features = ["macros", 'rt-multi-thread']}
serde = {version="1", features=["derive"]}
use serde::Deserialize;

use gotcha::{get, GotchaApp, Responder, State};
use gotcha::axum::extract::FromRef;

pub async fn hello_world(state: State<Config>) -> impl Responder {
    "hello world"
}

#[derive(Debug, Deserialize, Clone)]
struct Config {}

impl FromRef<(Config,)> for Config {
    fn from_ref(input: &(Config, )) -> Self {
        input.0.clone()
    }
}


#[tokio::main]
async fn main() {
    GotchaApp::<_, Config>::new()
        .route("/", get(hello_world))
        .done()
        .serve("127.0.0.1", 8000)
        .await
}

About

full featured web framework written by rust

Topics

Resources

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages