1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-10-21 17:33:59 +00:00

Add src directory to main.rs and list on first codeblock.

This commit is contained in:
memoryruins 2018-04-05 19:21:29 -04:00
parent 9f45cfe492
commit a0f1ff7eb3

View file

@ -1,14 +1,10 @@
# Getting Started # Getting Started
Lets create and run our first actix web application. Well create a new Cargo project Lets write our first actix web application!
that depends on actix web and then run the application.
In the previous section we already installed the required rust version. Now let's create a new cargo project.
## Hello, world! ## Hello, world!
Lets write our first actix web application! Start by creating a new binary-based Start by creating a new binary-based Cargo project and changing into the new directory:
Cargo project and changing into the new directory:
```bash ```bash
cargo new hello-world --bin cargo new hello-world --bin
@ -29,6 +25,7 @@ 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 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`: and returns a type that can be converted into `HttpResponse`:
Filename: src/main.rs
```rust ```rust
# extern crate actix_web; # extern crate actix_web;
# use actix_web::*; # use actix_web::*;
@ -67,7 +64,7 @@ connections. The server accepts a function that should return an `HttpHandler` i
That's it! Now, compile and run the program with `cargo run`. That's it! Now, compile and run the program with `cargo run`.
Head over to ``http://localhost:8088/`` to see the results. Head over to ``http://localhost:8088/`` to see the results.
Here is full source of main.rs file: The full source of src/main.rs is listed below:
```rust ```rust
# use std::thread; # use std::thread;