Full stack programmer new toy Rust (five) first http server

Can the zodiac, can be under the ocean to catch the turtle

Engage over graphics, and then engage in server

Ask the group to rust a bit, someone recommended

actix-web

image

70w download, rust in this ecosystem, it is very powerful. To learn about him.

Blow one up on the whole, compiling a long time, ah, things depend a little too much ......

image

Even then helloworld official website did not pass, and quickly see Quguan network tutorial

https://actix.rs/docs/getting-started/

image

Okay, this hidden transmission of the disease it alone actix-web is compiled, however, he rely on this actix-rt

There is a problem is that he's an example of hiding the real main function, to hide the details so I was very nervous beginner this, I really want to come back the main function

Fortunately, his example is very rich

https://github.com/actix/examples/tree/master/run-in-thread

I got my hidden details in the example in

image

Source code

https://gitee.com/lightsever/rust_study/tree/master/server_hello01

In the local port 8080 to open an http server

Only response http://127.0.0.1/ and http://127.0.0.1/index.html

This is our first rust http server a

Guess you like

Origin www.cnblogs.com/crazylights/p/12120209.html