ruwebframe 0.1.3

a simple webframe for rust actix-web, based on rudi and rbatis.
Documentation
use actix_web::{App, HttpResponse, HttpServer, Responder, get, post, web};

#[get("/")]
async fn hello() -> impl Responder {
    HttpResponse::Ok().body("Hello, Actix Web!")
}

#[post("/echo")]
async fn echo(req_body: String) -> impl Responder {
    HttpResponse::Ok().body(req_body)
}

async fn manual_hello() -> impl Responder {
    HttpResponse::Ok().body("Hey there!")
}

pub fn reg_route()  {
    let mut app = App::new();
    app.service(hello)
        .service(echo)
        .route("/hey", web::get().to(manual_hello));
}

#[actix_web::main]
async fn main() -> std::io::Result<()> {
    HttpServer::new(|| {
        App::new()
            .service(hello) // 宏定义路由
            .service(echo)
            .route("/hey", web::get().to(manual_hello)) // 手动路由
    })
    .bind(("0.0.0.0", 8066))?
    .run()
    .await
}

#[test]
fn test() {
    println!("Hello, world!");
}