init
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/target
|
||||
1427
Cargo.lock
generated
Normal file
1427
Cargo.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
10
Cargo.toml
Normal file
10
Cargo.toml
Normal 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
27
src/main.rs
Normal 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])
|
||||
}
|
||||
Reference in New Issue
Block a user