Skip to content

Instantly share code, notes, and snippets.

@LucasKauz
Last active March 6, 2021 16:15
Show Gist options
  • Save LucasKauz/25e4c3a825ec2326007d67a8f702e84e to your computer and use it in GitHub Desktop.
Save LucasKauz/25e4c3a825ec2326007d67a8f702e84e to your computer and use it in GitHub Desktop.
Just starting some doc on lessons learned

GreenRed

Rust

Watching the project

If you want to avoid the tedious task of re-running the cargo run for every change you make you can install cargo-watch then use it with run as the cargo command, like the following

cargo watch -x run # -x run means cargo will run cargo run on every change

Rocket.rs

Creating a new route

  • Create a new function with the get directive set to your route name
#[get("/my_route")]
fn my_route() -> &'static str {
    "1"
}
  • Add this new function into the routes array
rocket::ignite().mount("/", routes![hello, my_route]).launch();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment