From 58a8ba600faa813561f5e43bf9a1f2ff0e39d229 Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Tue, 9 Nov 2021 01:11:09 +0300 Subject: [PATCH] chore: update rocket example --- examples/rocket/Cargo.toml | 4 ++-- examples/rocket/src/main.rs | 15 ++++++--------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/examples/rocket/Cargo.toml b/examples/rocket/Cargo.toml index b588d39..ea6fe78 100644 --- a/examples/rocket/Cargo.toml +++ b/examples/rocket/Cargo.toml @@ -2,11 +2,11 @@ name = "itconfig-rocket-example" version = "0.1.0" authors = ["Dmitriy Pleshevskiy "] -edition = "2018" +edition = "2021" publish = false # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -rocket = "0.4.7" +rocket = "0.5.0-rc.1" itconfig = { path = '../../itconfig', features = ["macro"] } diff --git a/examples/rocket/src/main.rs b/examples/rocket/src/main.rs index f7cdc90..a330c72 100644 --- a/examples/rocket/src/main.rs +++ b/examples/rocket/src/main.rs @@ -3,10 +3,8 @@ #[macro_use] extern crate rocket; -use itconfig::config; - -config! { - ROCKET { +itconfig::config! { + rocket { HOST: String => "localhost", PORT: u16 => 9000, BASE_URL => "/", @@ -14,14 +12,13 @@ config! { } #[get("/")] -fn index() -> &'static str { +fn hello() -> &'static str { "Hello, world!" } -fn main() { +#[launch] +fn rocket() -> _ { config::init(); - rocket::ignite() - .mount(config::ROCKET::BASE_URL(), routes![index]) - .launch(); + rocket::build().mount(config::rocket::BASE_URL(), routes![hello]) }