What is the static file HTTP server see under Rust
This article shows you what the static file HTTP server see under Rust is like, the content is concise and easy to understand, it can definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
Here is the static file HTTP server under Rust.
See is a HTTP server for static files. The introduction to its Github repository is very simple and includes features such as
Support HTTP/1 and HTTP/2 support content compression (automatic, gzip,deflate,br) support multiple configuration methods
It feels intuitively that the function of see is similar to that of nginx, so let's try using the see library.
Development environment
Windows 10cargo-- version: cargo 1.46.0-nightly (089cbb80b 2020-06-15) rustc-- version: rustc 1.46.0-nightly (6bb3dbfc6 2020-06-22) uses see directly through an executable program
First download the executable file of see. After decompression, you need to create a file called .config.yml in the directory C:\ Users\ $USER_NAME\ .see, and write the contents of the file into
-server: listen: 80 root: C:\ Users\ $USER_NAME\ .see\ www
Create another folder called www
The file structure is as follows
Here we test the content is: use see webserver to host a React App website, the React part of the content here do not elaborate, we generate React App is a SPA static page, so meet the requirements of testing see.
Copy the React App generated by the npm run build command to the C:\ Users\ $USER_NAME\ .see\ www folder you just created
Then run the command in the directory of the downloaded executable file
See.exe
Access localhost:80 through the browser and refer to the port defined in the config.yml file we configured above. We can see that see successfully hosts React App.
See also supports more complex configurations, similar to the options in nginx.conf.
The above is what the static file HTTP server see looks like under Rust. Have you learned any knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.