к каталогу

📦 xitca-web/ HFQR

An HTTP library and web framework for safe Rust

Открыть на GitHubобновлён 2мес назад
Звёзды
998
Форки
66
За неделю
За месяц
Рост %
Язык
Rust

Установка и запуск

Quick Start

For a list of other examples, see: Examples

To get started using Xitca-web add the following code to your main.rs file:

use xitca_web::{handler::handler_service, middleware::Logger, route::get, App};

async fn index() -> &'static str {
    "Hello world!!"
}

fn main() -> std::io::Result<()> {
    App::new()
        .at("/", get(handler_service(index)))
        .enclosed(Logger::new())
        .serve()
        .bind("localhost:8080")?
        .run()
        .wait()
}

And then add the following dependencies to your Cargo.toml file:

xitca-web = { version = "*" , features = ["logger"]}

And then run the application/server using cargo run command and it should start the server/application on http://127.0.0.1:8080. Open your prefered browser and navigate to the address on which the server has started and you should see a hello world!! message appear.

[!Warning] The project is still not stable. So expect breaking changes to appear at any time.

⬆️ Back to Top

Из README репозитория · полный README на GitHub

Категории

Теги

httprustweb-framework