Logo

dev-resources.site

for different kinds of informations.

πŸ¦€ Axum - Hello World !

Published at
3/18/2024
Categories
rust
axum
webassembly
beginners
Author
YellowCoder
Categories
4 categories in total
rust
open
axum
open
webassembly
open
beginners
open
πŸ¦€ 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();
}

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

Featured ones: