#Service chaining on registering to App::new()

1 messages · Page 1 of 1 (latest)

tropic ibex
#

Sample code of how am registering the scopes under App::new

use app::{controller::app_controller, users::controller::user_controller};
mod app;
```
#
async fn main()-> std::io::Result<()> {
    HttpServer::new(||{
#
    })
    .bind(("127.0.0.1", 8080))?
    .run()
    .await
}```
#

This is sample of how I register the endpoints under a given scope

async fn trial()-> impl Responder{
    HttpResponse::Ok().body("Hello there")
}

pub fn user_controller()-> Scope{
    scope("users")
        .service(signup_handler)
        .service(trial)
}