This commit is contained in:
Tommy Parnell
2021-12-28 13:57:26 -05:00
commit 6375754ba0
4 changed files with 1465 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/target

1427
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

10
Cargo.toml Normal file
View File

@@ -0,0 +1,10 @@
[package]
name = "hello-rocket"
version = "0.1.0"
authors = ["tparnell <tommy@terribledev.io>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
rocket = "0.5.0-rc.1"

27
src/main.rs Normal file
View File

@@ -0,0 +1,27 @@
#[macro_use] extern crate rocket;
#[get("/")]
fn index() -> &'static str {
"Hello, world!"
}
// #[launch]
// fn rocket() -> _ {
// // let cfg = rocket::config::Config
// // .address("0.0.0.0")
// // .port(port)
// // .unwrap();
// // rocket::build()
// //.configure(cfg)
// // .mount("/", routes![index])
// // .launch()
// rocket::ignite().mount("/", routes![index]).launch();
// }
#[launch]
fn rocket() -> _ {
let port = std::env::var("PORT").unwrap_or("8000".to_string());
let port_as_int = port.parse::<u16>().unwrap();
let figmant = rocket::Config::figment().merge(("port", port_as_int));
rocket::custom(figmant).mount("/", routes![index])
}