Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A web framework for Rust.

License

NotificationsYou must be signed in to change notification settings

rwf2/Rocket

Repository files navigation

Build StatusRocket HomepageCurrent Crates.io VersionMatrix: #rocket:mozilla.org

Rocket is an async web framework for Rust with a focus on usability, security,extensibility, and speed.

#[macro_use]externcrate rocket;#[get("/<name>/<age>")]fnhello(name:&str,age:u8) ->String{format!("Hello, {} year old named {}!", age, name)}#[launch]fnrocket() ->_{    rocket::build().mount("/hello",routes![hello])}

Visitinglocalhost:8000/hello/John/58, for example, will trigger thehelloroute resulting in the stringHello, 58 year old named John! being sent to thebrowser. If an<age> string was passed in that can't be parsed as au8, theroute won't get called, resulting in a 404 error.

Documentation

Rocket is extensively documented:

Documentation for themaster branch is available athttps://rocket.rs/masterandhttps://api.rocket.rs/master.

Documentation for major release version${x} is available athttps://[api.]rocket.rs/v${x}. For example, the v0.4 docs are available athttps://rocket.rs/v0.4 andhttps://api.rocket.rs/v0.4.

Finally, API docs for active git branches are available athttps://api.rocket.rs/${branch}. For example, API docs for themaster branchare available athttps://api.rocket.rs/master. Branch rustdocs are built anddeployed on every commit.

Examples

Theexamples directory contains complete crates that showcaseRocket's features and usage. Each example can be compiled and run with Cargo.For instance, the following sequence of commands builds and runs thehelloexample:

cd examples/hellocargo run

Getting Help

If you find yourself needing help outside of the documentation, you may:

Contributing

Contributions are absolutely, positively welcomed and encouraged! If you'reinterested in contributing code, please first readCONTRIBUTING for completeguidelines. Additionally, you could:

  1. Submit a feature request or bug report as anissue.
  2. Ask for improved documentation as anissue.
  3. Comment onissues that require feedback.
  4. Answers questions inGitHub discussions questions.
  5. Share a project inGitHub discussions show & tell.

License

Rocket is licensed under either of the following, at your option:

Unless you explicitly state otherwise, any contribution intentionally submittedfor inclusion in Rocket by you shall be dual licensed under the MIT License andApache License, Version 2.0, without any additional terms or conditions.

The Rocket website docs are licensed underseparate terms. Anycontribution intentionally submitted for inclusion in the Rocket website docs byyou shall be licensed under those terms.


[8]ページ先頭

©2009-2025 Movatter.jp