[go: up one dir, main page]

DEV Community

Cover image for πŸ¦€ Axum - Hello World !
YellowCoder
YellowCoder

Posted on

πŸ¦€ Axum - Hello World !

Axum is a web application framework that focuses on ergonomics and modularity.

This yellowcoder-tibbit tells you about a simple Axum - β€œHello World!” examples you can get quickly started with by following steps given in repo.

use axum::{response::Html, routing::get, Router};

#[tokio::main]
async fn main() {

    let app = Router::new().route("/",get(||async {
        Html("
            <h1>Hello World</h1>
            <h2>Here Rust Server is running....</h2>
            Author: <strong>Yellow Coder</strong>
            ")

    }));

    let listener = tokio::net::TcpListener::bind("127.0.0.1:3000").await.unwrap();

    axum::serve(listener,app).await.unwrap();
}

Enter fullscreen mode Exit fullscreen mode

GitRepo : https://github.com/shubhamlodhi/rusty-fork.git

Top comments (0)