actix-web README

The project's README from github.com/actix/actix-web. As one markdown file: README.md.

Actix Web

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

crates.io Documentation MSRV MIT or Apache 2.0 licensed Dependency Status
CI Coverage downloads Chat on Discord

Features

Experimental features

To enable faster release iterations, we mark some features as experimental. These features are prefixed with experimental and a breaking change may happen at any release. Please use them in a production environment at your own risk.

Documentation

Example

Dependencies:

[dependencies]
actix-web = "4"

Code:

use actix_web::{get, web, App, HttpServer, Responder};

#[get("/hello/{name}")]
async fn greet(name: web::Path<String>) -> impl Responder {
    format!("Hello {name}!")
}

#[actix_web::main] // or #[tokio::main]
async fn main() -> std::io::Result<()> {
    HttpServer::new(|| {
        App::new().service(greet)
    })
    .bind(("127.0.0.1", 8080))?
    .run()
    .await
}

More Examples

You may consider checking out this directory for more examples.

Benchmarks

One of the fastest web frameworks available according to the TechEmpower Framework Benchmark.

License

This project is licensed under either of the following licenses, at your option:

Code of Conduct

Contribution to the actix/actix-web repo is organized under the terms of the Contributor Covenant. The Actix team promises to intervene to uphold that code of conduct.

actix-web (actix/actix-web)

Searching Database…

24.9K ·GitHub
这是什么?Actix Web 是一个功能强大、务实且极其快速的 Rust Web 框架,用于构建 Web 服务器、API 和实时服务。
它是一个完整的框架,还是只是一个轻量的 HTTP 库?是一个完整的 Web 框架:请求路由(支持可选的宏)、中间件、WebSockets、静态资源、内容压缩以及一个内置的 HTTP 客户端,都打包在一起。
我怎么开始用它搭建一个服务器?把 actix-web 这个 crate 添加到你的 Cargo.toml,然后从项目示例仓库中的 Hello World 或 Basic Setup 示例入手。
我需要哪个 Rust 版本,是否内置了异步支持?稳定版 Rust 1.88 或更高版本就够了,而且异步是内置的:这个框架完全兼容 Tokio,不需要额外配置运行时。
它有没有哪部分还不稳定、依赖起来有风险?带有 'experimental' 前缀的功能在任意一次发布中都可能发生变化,README 中说明在生产环境使用它们需自担风险。
在商业项目里使用它是免费的吗?是的,它同时采用 Apache-2.0 和 MIT 双重许可,你可以任选其中一种适用于你的项目。
它真的是最快的 Web 框架之一吗?README 引用了 TechEmpower Framework Benchmark(框架基准测试),Actix Web 在其中位列最快的 Web 框架之中。
它只能处理进来的请求,还是也能主动发起 HTTP 调用?两者都可以:除了服务端之外,它还集成了 awc 这个 HTTP 客户端,可以发起对外请求。
有没有数据库和 WebSockets 的现成示例?有。示例仓库涵盖了 JSON 处理、MongoDB、Diesel、SQLite 和 Postgres 集成、Tera 和 Askama 模板、使用 Rustls 或 OpenSSL 的 HTTPS,以及一个 WebSocket 聊天示例。
What are similar projects?echo, warp, starlette, Rocket, aiohttp, axum, pingora, nginxconfig.io
Creator
actix
Size
17.9 MB
Stars
24.9K
Age
9y
Commits · 90 Days