This repository has been archived on 2022-07-24. You can view files and clone it, but cannot push or open issues or pull requests.
itconfig/examples/rocket.rs

23 lines
352 B
Rust
Raw Normal View History

2019-12-31 08:45:50 +03:00
#[macro_use]
extern crate rocket;
2021-11-09 01:11:09 +03:00
itconfig::config! {
rocket {
2020-01-07 17:20:58 +03:00
HOST: String => "localhost",
PORT: u16 => 9000,
2020-02-08 22:11:37 +03:00
BASE_URL => "/",
2019-12-31 08:45:50 +03:00
}
}
#[get("/")]
2021-11-09 01:11:09 +03:00
fn hello() -> &'static str {
2019-12-31 08:45:50 +03:00
"Hello, world!"
}
2021-11-09 01:11:09 +03:00
#[launch]
fn rocket() -> _ {
2020-03-12 23:20:34 +03:00
config::init();
2019-12-31 08:45:50 +03:00
2021-11-09 01:11:09 +03:00
rocket::build().mount(config::rocket::BASE_URL(), routes![hello])
2020-07-02 20:54:17 +03:00
}