actix-http
cargo install actix-http

actix-http

Actix Web is a powerful, pragmatic, and extremely fast web framework for Rust.

by actix

3.1.0 (see all)License:MIT OR Apache-2.0
cargo install actix-http
Readme

actix-http

HTTP primitives for the Actix ecosystem.

crates.io Documentation Version MIT or Apache 2.0 licensed
dependency status Download Chat on Discord

Documentation & Resources

Example

use std::{env, io};


use actix_http::{HttpService, Response};
use actix_server::Server;
use futures_util::future;
use http::header::HeaderValue;
use tracing::info;




#[actix_rt::main]
async fn main() -> io::Result<()> {
env::set_var("RUST_LOG", "hello_world=info");
env_logger::init();



Server::build()
    .bind("hello-world", "127.0.0.1:8080", || {
        HttpService::build()
            .client_timeout(1000)
            .client_disconnect(1000)
            .finish(|_req| {
                info!("{:?}", _req);
                let mut res = Response::Ok();
                res.header("x-head", HeaderValue::from_static("dummy value!"));
                future::ok::&lt;_, ()&gt;(res.body("Hello world!"))
            })
            .tcp()
    })?
    .run()
    .await




}

}

License

This project is licensed under either of

at your option.

Code of Conduct

Contribution to the actix-http crate is organized under the terms of the Contributor Covenant, the maintainer of actix-http, @fafhrd91, promises to intervene to uphold that code of conduct.

GitHub Stars

14.3K

LAST COMMIT

15d ago

MAINTAINERS

1

CONTRIBUTORS

331

OPEN ISSUES

111

OPEN PRs

22
VersionTagPublished
3.1.0
15d ago
3.0.4
4mos ago
3.0.3
4mos ago
3.0.2
4mos ago
No alternatives found
No tutorials found
Add a tutorial