1
0
mirror of https://github.com/actix/actix-website synced 2025-01-22 08:05:56 +01:00

docs: disabiguate method for a callable from http method (#508)

* docs: disabiguate method for a callable from http method

Already said HTTP Method but added a link to highlight the difference. And a note to say that it doesn't change the matching rules.

* Update url-dispatch.md

---------

Co-authored-by: Rob Ede <robjtede@icloud.com>
This commit is contained in:
Onè 2024-12-18 04:11:07 -05:00 committed by GitHub
parent b4d473723e
commit c7d194ee3f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -14,7 +14,7 @@ URL dispatch provides a simple way for mapping URLs to handler code using a simp
Resource configuration is the act of adding a new resources to an application. A resource has a name, which acts as an identifier to be used for URL generation. The name also allows developers to add routes to existing resources. A resource also has a pattern, meant to match against the _PATH_ portion of a _URL_ (the portion following the scheme and port, e.g. _/foo/bar_ in the _URL_ _`http://localhost:8080/foo/bar?q=value`_). It does not match against the _QUERY_ portion (the portion that follows _?_, e.g. _q=value_ in _`http://localhost:8080/foo/bar?q=value`_).
The [_App::route()_][approute] method provides simple way of registering routes. This method adds a single route to application routing table. This method accepts a _path pattern_, _HTTP method_ and a handler function. `route()` method could be called multiple times for the same path, in that case, multiple routes register for the same resource path.
The [_App::route()_][approute] method provides simple way of registering routes. This method adds a single route to the application routing table. This method accepts a _path pattern_, [_HTTP method_][httpmethod] and a handler function. The `route()` method could be called multiple times for the same path, in that case, multiple routes register for the same resource path. Note: the first match is used so unless the [_HTTP method_][httpmethod] or guards are different only the first will be used (see [route matching](#route-matching) for more info).
<CodeBlock example="url-dispatch" section="main" />
@ -300,3 +300,4 @@ If the path pattern can not be found in the routing table or a resource can not
[implfromrequest]: https://docs.rs/actix-web/4/actix_web/trait.FromRequest.html
[implresponder]: https://docs.rs/actix-web/4/actix_web/trait.Responder.html
[pathextractor]: /docs/extractors
[httpmethod]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods