mirror of
https://github.com/actix/actix-website
synced 2025-06-29 08:14:58 +02:00
updates Getting Started.
This commit is contained in:
@ -27,18 +27,17 @@ actix-web = "{{< actix-version "actix-web" >}}"
|
||||
|
||||
In order to implement a web server, we first need to create a request handler.
|
||||
|
||||
A request handler is a function that accepts an `HttpRequest` instance as its only parameter
|
||||
and returns a type that can be converted into `HttpResponse`:
|
||||
|
||||
Filename: `src/main.rs`
|
||||
A request handler is a function that accepts any type that can be extracted from a
|
||||
request (ie, `impl FromRequest`) as its only parameter and returns a type that
|
||||
can be converted into an `HttpResponse` (ie, `impl Responder`):
|
||||
|
||||
{{< include-example example="getting-started" section="setup" >}}
|
||||
|
||||
Next, create an `Application` instance and register the request handler with
|
||||
the application's `resource` on a particular *HTTP method* and *path* and
|
||||
Next, create an `App` instance and register the request handler with
|
||||
the application's `route` on a particular *HTTP method* and *path* and
|
||||
after that, the application instance can be used with `HttpServer` to listen
|
||||
for incoming connections. The server accepts a function that should return an
|
||||
`HttpResponse`.
|
||||
application factory.
|
||||
|
||||
{{< include-example example="getting-started" section="main" >}}
|
||||
|
||||
|
Reference in New Issue
Block a user