mirror of
https://github.com/actix/actix-extras.git
synced 2024-11-24 07:53:00 +01:00
simplier example in readme
This commit is contained in:
parent
fd87eb59f8
commit
5e6a0aa3df
@ -33,7 +33,7 @@ Actix web is a simple, pragmatic and extremely fast web framework for Rust.
|
|||||||
|
|
||||||
```rust
|
```rust
|
||||||
extern crate actix_web;
|
extern crate actix_web;
|
||||||
use actix_web::{server, App, Path};
|
use actix_web::{http, server, App, Path};
|
||||||
|
|
||||||
fn index(info: Path<(u32, String)>) -> String {
|
fn index(info: Path<(u32, String)>) -> String {
|
||||||
format!("Hello {}! id:{}", info.0, info.1)
|
format!("Hello {}! id:{}", info.0, info.1)
|
||||||
@ -42,7 +42,7 @@ fn index(info: Path<(u32, String)>) -> String {
|
|||||||
fn main() {
|
fn main() {
|
||||||
server::new(
|
server::new(
|
||||||
|| App::new()
|
|| App::new()
|
||||||
.resource("/{id}/{name}/index.html", |r| r.with(index)))
|
.route("/{id}/{name}/index.html", http::Method::GET, index))
|
||||||
.bind("127.0.0.1:8080").unwrap()
|
.bind("127.0.0.1:8080").unwrap()
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user