logo

Function salvo_core::run

source · []
pub fn run<F: Future>(future: F)
Expand description

If you don’t want to include tokio in your project directly, you can use this function to run server.

Example


#[fn_handler]
async fn hello_world() -> &'static str {
    "Hello World"
}
#[tokio::main]
async fn main() {
   let router = Router::new().get(hello_world);
   let server = Server::new(TcpListener::bind("127.0.0.1:7878")).serve(router);
   salvo_core::run(server);
}