Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the static file HTTP server see under Rust

2025-02-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report