4 个稳定版本
1.0.3 | 2022年12月5日 |
---|
#1205 in HTTP服务器
43KB
909 行
rs-starter
安装Rust开发环境
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
cargo-watch 用于监控项目中的文件变化并运行命令。
$ cargo install cargo-watch
创建项目
$ cargo new hello-rocket --bin $ cd hello-rocket
[依赖] rocket = "0.5.0-rc.2"
crate
Docs.rs
https://docs.rs/ https://docs.rs/rocket-include-static-resources/latest/rocket_include_static_resources/
遇见Rocket。
rocket vs actix-web
https://kerkour.com/rust-web-framework-2022 https://stackshare.io/stackups/actix-vs-rocket
https://livebook.manning.com/book/rust-servers-services-and-apps/chapter-3/v-10/43
Rust模块和路径(一)
https://blog.csdn.net/kakadiablo/article/details/115400316
打包和分发一个Rust工具
http://llever.com/cli-wg-zh/tutorial/packaging.zh.html
https://msfjarvis.dev/posts/building-static-rust-binaries-for-linux/
Rust入门指南(crate管理)
https://zhuanlan.zhihu.com/p/546235064
Rust日常开发中的倚天屠龙
https://zhuanlan.zhihu.com/p/451494651?utm_id=0
actix-web
https://actix.rs/ https://github.com/actix/actix-extras https://blog.logrocket.com/building-rest-api-rust-rhai-actix-web/ https://actix.rs/docs/url-dispatch/
api doc
https://api.rocket.rs/ https://api.rocket.rs/v0.4/rocket/http/struct.ContentType.html
在Rust中创建一个闪电般的REST API(第1/2部分)
https://hub.qovery.com/guides/tutorial/create-a-blazingly-fast-api-in-rust-part-1/
https://github.com/blurbyte/restful-rust https://github.com/grizwako/rust-websocket-chat-server https://github.com/steelx/rust-rocket-chat-app
Rust配置日志
https://rust-lang-nursery.github.io/rust-cookbook/development_tools/debugging/config_log.html https://docs.rs/log4rs/1.2.0/log4rs/ https://docs.rs/log4rs/latest/log4rs/ https://docs.rs/log4rs/latest/log4rs/encode/pattern/ https://github.com/qoollo/rust-log4rs-logstash https://docs.rs/actix-web/latest/actix_web/middleware/struct.Logger.html https://medium.com/nikmas-group-rust/advanced-logging-in-rust-with-log4rs-2d712bb322de https://stackoverflow.com/questions/74053633/actix-web-middleware-logger-output-to-file https://medium.com/nerd-for-tech/logging-in-rust-e529c241f92e https://dev.to/chaudharypraveen98/adding-slog-logger-to-actix-web-2332 https://stackoverflow.com/questions/67148186/why-custom-filter-not-working-in-log4rs1-0 https://docs.rs/actix-ip-filter/latest/actix_ip_filter/ https://github.com/jhen0409/actix-ip-filter
https://dev.to/hackmamba/build-a-rest-api-with-rust-and-mongodb-actix-web-version-ei1 https://auth0.com/blog/build-an-api-in-rust-with-jwt-authentication-using-actix-web/ https://users.rust-lang.org/t/error-404-unfound-routes-actix-web/46484/3
https://github.com/secretkeysio/jelly-actix-web-starter
rust-servers-services-and-apps
5 处理错误
https://livebook.manning.com/book/rust-servers-services-and-apps/chapter-5/v-12/40 https://docs.rs/actix-web/0.5.3/actix_web/middleware/struct.ErrorHandlers.html https://dev.to/chaudharypraveen98/error-handling-in-actix-web-4mm
时间
https://github.com/tailhook/humantime https://doc.rust-lang.net.cn/stable/std/time/struct.Duration.html https://crates.io/crates/duration-string https://docs.rs/human-repr/1.0.1/human_repr/
Day12: 使用actix-web编写Web应用程序 - 100DayOfRust
https://dev.to/0xbf/day11-write-web-app-with-actix-web-100dayofrust-1lkn
异步化Actix Web应用程序并将其升级到1.0
https://www.zupzup.org/asyncify-rust-webapp/
模板
https://tera.netlify.app/docs/ https://github.com/Keats/tera
验证器
https://github.com/rambler-digital-solutions/actix-web-validator https://dev.to/chaudharypraveen98/form-validation-in-rust-404l
https://docs.rs/actix-ratelimit/latest/actix_ratelimit/ https://blog.logrocket.com/the-state-of-rust-http-clients/
详细讲解Rust错误处理
依赖项
~46–61MB
~1M SLoC