mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-24 07:53:00 +01:00
update readme
This commit is contained in:
parent
bd1e9abdd8
commit
3de43c2a46
61
README.md
61
README.md
@ -1,6 +1,24 @@
|
|||||||
# Actix web [![Build Status](https://travis-ci.org/actix/actix-web.svg?branch=master)](https://travis-ci.org/actix/actix-web) [![Build status](https://ci.appveyor.com/api/projects/status/kkdb4yce7qhm5w85/branch/master?svg=true)](https://ci.appveyor.com/project/fafhrd91/actix-web-hdy9d/branch/master) [![codecov](https://codecov.io/gh/actix/actix-web/branch/master/graph/badge.svg)](https://codecov.io/gh/actix/actix-web) [![crates.io](http://meritbadge.herokuapp.com/actix-web)](https://crates.io/crates/actix-web)
|
# Actix web [![Build Status](https://travis-ci.org/actix/actix-web.svg?branch=master)](https://travis-ci.org/actix/actix-web) [![Build status](https://ci.appveyor.com/api/projects/status/kkdb4yce7qhm5w85/branch/master?svg=true)](https://ci.appveyor.com/project/fafhrd91/actix-web-hdy9d/branch/master) [![codecov](https://codecov.io/gh/actix/actix-web/branch/master/graph/badge.svg)](https://codecov.io/gh/actix/actix-web) [![crates.io](http://meritbadge.herokuapp.com/actix-web)](https://crates.io/crates/actix-web)
|
||||||
|
|
||||||
Asynchronous web framework for [Actix](https://github.com/actix/actix).
|
Actix web is a small, fast, down-to-earth, open source rust web framework.
|
||||||
|
|
||||||
|
```rust,ignore
|
||||||
|
extern crate actix_web;
|
||||||
|
use actix_web::*;
|
||||||
|
|
||||||
|
fn index(req: HttpRequest) -> String {
|
||||||
|
format!("Hello {}!", &req.match_info()["name"])
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
HttpServer::new(
|
||||||
|
Application::default("/")
|
||||||
|
.resource("/{name}", |r| r.method(Method::GET).f(index)))
|
||||||
|
.serve::<_, ()>("127.0.0.1:8080");
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
* [User Guide](http://actix.github.io/actix-web/guide/)
|
* [User Guide](http://actix.github.io/actix-web/guide/)
|
||||||
* [API Documentation (Development)](http://actix.github.io/actix-web/actix_web/)
|
* [API Documentation (Development)](http://actix.github.io/actix-web/actix_web/)
|
||||||
@ -8,10 +26,6 @@ Asynchronous web framework for [Actix](https://github.com/actix/actix).
|
|||||||
* Cargo package: [actix-web](https://crates.io/crates/actix-web)
|
* Cargo package: [actix-web](https://crates.io/crates/actix-web)
|
||||||
* Minimum supported Rust version: 1.20 or later
|
* Minimum supported Rust version: 1.20 or later
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
Actix web is licensed under the [Apache-2.0 license](http://opensource.org/licenses/APACHE-2.0).
|
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
* Supported HTTP/1 and HTTP/2 protocols
|
* Supported HTTP/1 and HTTP/2 protocols
|
||||||
@ -22,15 +36,7 @@ Actix web is licensed under the [Apache-2.0 license](http://opensource.org/licen
|
|||||||
* Configurable request routing
|
* Configurable request routing
|
||||||
* Multipart streams
|
* Multipart streams
|
||||||
* Middlewares (Logger, Session included)
|
* Middlewares (Logger, Session included)
|
||||||
|
* Built on top of [Actix](https://github.com/actix/actix).
|
||||||
## Usage
|
|
||||||
|
|
||||||
To use `actix-web`, add this to your `Cargo.toml`:
|
|
||||||
|
|
||||||
```toml
|
|
||||||
[dependencies]
|
|
||||||
actix-web = { git = "https://github.com/actix/actix-web" }
|
|
||||||
```
|
|
||||||
|
|
||||||
## HTTP/2
|
## HTTP/2
|
||||||
|
|
||||||
@ -54,7 +60,7 @@ and tls connection. [rfc section 3.4](https://http2.github.io/http2-spec/#rfc.se
|
|||||||
|
|
||||||
[tls example](https://github.com/actix/actix-web/tree/master/examples/tls)
|
[tls example](https://github.com/actix/actix-web/tree/master/examples/tls)
|
||||||
|
|
||||||
## Example
|
## Examples
|
||||||
|
|
||||||
* [Basic](https://github.com/actix/actix-web/tree/master/examples/basic.rs)
|
* [Basic](https://github.com/actix/actix-web/tree/master/examples/basic.rs)
|
||||||
* [Stateful](https://github.com/actix/actix-web/tree/master/examples/state.rs)
|
* [Stateful](https://github.com/actix/actix-web/tree/master/examples/state.rs)
|
||||||
@ -63,27 +69,6 @@ and tls connection. [rfc section 3.4](https://http2.github.io/http2-spec/#rfc.se
|
|||||||
* [Tcp/Websocket chat](https://github.com/actix/actix-web/tree/master/examples/websocket-chat)
|
* [Tcp/Websocket chat](https://github.com/actix/actix-web/tree/master/examples/websocket-chat)
|
||||||
* [SockJS Server](https://github.com/actix/actix-sockjs)
|
* [SockJS Server](https://github.com/actix/actix-sockjs)
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
```rust
|
Actix web is licensed under the [Apache-2.0 license](http://opensource.org/licenses/APACHE-2.0).
|
||||||
# extern crate actix;
|
|
||||||
# extern crate actix_web;
|
|
||||||
#
|
|
||||||
use actix::*;
|
|
||||||
use actix_web::*;
|
|
||||||
|
|
||||||
fn index(req: HttpRequest) -> String {
|
|
||||||
format!("Hello {}!", &req.match_info()["name"])
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
let sys = actix::System::new("ws-example");
|
|
||||||
|
|
||||||
HttpServer::new(
|
|
||||||
Application::default("/")
|
|
||||||
.resource("/{name}", |r| r.method(Method::GET).f(index)))
|
|
||||||
.serve::<_, ()>("127.0.0.1:8080").unwrap();
|
|
||||||
|
|
||||||
Arbiter::system().send(msgs::SystemExit(0));
|
|
||||||
let _ = sys.run();
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
Loading…
Reference in New Issue
Block a user