1
0
mirror of https://github.com/actix/examples synced 2024-11-23 22:41:07 +01:00

git push fix basics

This commit is contained in:
krircc 2018-04-15 10:45:30 +08:00
commit c0ddc4bd9d
3 changed files with 2 additions and 3 deletions

View File

@ -16,6 +16,7 @@ cargo run
- [http://localhost:8080/async/bob](http://localhost:8080/async/bob) - [http://localhost:8080/async/bob](http://localhost:8080/async/bob)
- [http://localhost:8080/user/bob/](http://localhost:8080/user/bob/) plain/text download - [http://localhost:8080/user/bob/](http://localhost:8080/user/bob/) plain/text download
- [http://localhost:8080/test](http://localhost:8080/test) (return status switch GET or POST or other) - [http://localhost:8080/test](http://localhost:8080/test) (return status switch GET or POST or other)
- [http://localhost:8080/favicon](http://localhost:8080/static/favicon.htmicol)
- [http://localhost:8080/welcome](http://localhost:8080/static/welcome.html) - [http://localhost:8080/welcome](http://localhost:8080/static/welcome.html)
- [http://localhost:8080/notexit](http://localhost:8080/static/404.html) display 404 page - [http://localhost:8080/notexit](http://localhost:8080/static/404.html) display 404 page
- [http://localhost:8080/error](http://localhost:8080/error) Panic after request - [http://localhost:8080/error](http://localhost:8080/error) Panic after request

View File

@ -98,7 +98,6 @@ fn main() {
// async handler // async handler
.resource("/async/{name}", |r| r.method(Method::GET).a(index_async)) .resource("/async/{name}", |r| r.method(Method::GET).a(index_async))
.resource("/test", |r| r.f(|req| { .resource("/test", |r| r.f(|req| {
println!("=============test=============");
match *req.method() { match *req.method() {
Method::GET => HttpResponse::Ok(), Method::GET => HttpResponse::Ok(),
Method::POST => HttpResponse::MethodNotAllowed(), Method::POST => HttpResponse::MethodNotAllowed(),
@ -106,7 +105,6 @@ fn main() {
} }
})) }))
.resource("/error", |r| r.f(|req| { .resource("/error", |r| r.f(|req| {
println!("=============error=============");
error::InternalError::new( error::InternalError::new(
io::Error::new(io::ErrorKind::Other, "test"), StatusCode::OK) io::Error::new(io::ErrorKind::Other, "test"), StatusCode::OK)
})) }))

View File

@ -87,4 +87,4 @@
<input id="send" type="button" value="Send" /> <input id="send" type="button" value="Send" />
</form> </form>
</body> </body>
</html> </html>