Skip to content

Instantly share code, notes, and snippets.

@wijiler
Last active July 28, 2021 01:02
Show Gist options
  • Select an option

  • Save wijiler/23b4d45056f5ef46b813fa8fb7440ba1 to your computer and use it in GitHub Desktop.

Select an option

Save wijiler/23b4d45056f5ef46b813fa8fb7440ba1 to your computer and use it in GitHub Desktop.
server in https://rocket.rs
#[macro_use] extern crate rocket;
use rocket::Request;
#[get("/")]
fn insertfunctionnamehere() -> &'static str {
"Insert words here"
}
#[catch(404)]
fn not_found(req: &Request) -> String {
format!("404 could not find '{}' did ya mistype that?", req.uri())
}
#[launch]
rocket::build().mount("/", routes![index])
.register("/", catchers![not_found])
/* for multipage do the same thing with the #[get("/")] macro (including the same "/") and have a
function with a different name and do .mount("/insertnameofpagehere", routes[functionname])
and then you should have a multi page website*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment