chore: update rocket example
This commit is contained in:
parent
ca5113f1fb
commit
58a8ba600f
2 changed files with 8 additions and 11 deletions
|
@ -2,11 +2,11 @@
|
||||||
name = "itconfig-rocket-example"
|
name = "itconfig-rocket-example"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
authors = ["Dmitriy Pleshevskiy <dmitriy@ideascup.me>"]
|
authors = ["Dmitriy Pleshevskiy <dmitriy@ideascup.me>"]
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
rocket = "0.4.7"
|
rocket = "0.5.0-rc.1"
|
||||||
itconfig = { path = '../../itconfig', features = ["macro"] }
|
itconfig = { path = '../../itconfig', features = ["macro"] }
|
||||||
|
|
|
@ -3,10 +3,8 @@
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate rocket;
|
extern crate rocket;
|
||||||
|
|
||||||
use itconfig::config;
|
itconfig::config! {
|
||||||
|
rocket {
|
||||||
config! {
|
|
||||||
ROCKET {
|
|
||||||
HOST: String => "localhost",
|
HOST: String => "localhost",
|
||||||
PORT: u16 => 9000,
|
PORT: u16 => 9000,
|
||||||
BASE_URL => "/",
|
BASE_URL => "/",
|
||||||
|
@ -14,14 +12,13 @@ config! {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[get("/")]
|
#[get("/")]
|
||||||
fn index() -> &'static str {
|
fn hello() -> &'static str {
|
||||||
"Hello, world!"
|
"Hello, world!"
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
#[launch]
|
||||||
|
fn rocket() -> _ {
|
||||||
config::init();
|
config::init();
|
||||||
|
|
||||||
rocket::ignite()
|
rocket::build().mount(config::rocket::BASE_URL(), routes![hello])
|
||||||
.mount(config::ROCKET::BASE_URL(), routes![index])
|
|
||||||
.launch();
|
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue