B0ud / actix-gym-training

Rust & Actix Web exploration. Set up of an application that records the series and repetitions of a sports session

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Actix-gym-training

Rust & Actix Web exploration. Set up of an application that records the series and repetitions of a sports session

Version Build Status codecov

Database

In the past I did a quick test by doing a synchronous implementation : gym-schedule with Diesel

In this second iteration I would like to explore another option: async db adapters

https://github.com/prisma/quaint

Async Options

We have several example projects showing use of async database adapters:

Features

Documentation

Example

Request:

 curl http://localhost:8080/xxxxxxx

Code:

use actix_web::{get, post, web, App,Error, HttpResponse, HttpServer, Responder};

#[get("/")]
async fn hello() -> impl Responder {
    HttpResponse::Ok().body("Hello world! πŸ™ˆπŸ™‰πŸ™Š").with_header("Content-type", "text/html; charset=utf-8")
}

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

#[actix_web::main]
async fn main() -> std::io::Result<()> {
    HttpServer::new(|| {
        App::new()
            .service(hello)
            .service(echo)
            .service(stream)
            .route("/hey", web::get().to(manual_hello))
    })
        .bind("127.0.0.1:8080")?
        .run()
        .await
}

More examples

Benchmarks

License

About

Rust & Actix Web exploration. Set up of an application that records the series and repetitions of a sports session


Languages

Language:Rust 99.1%Language:Shell 0.9%