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"
|
||||
version = "0.1.0"
|
||||
authors = ["Dmitriy Pleshevskiy <dmitriy@ideascup.me>"]
|
||||
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"] }
|
||||
|
|
|
@ -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])
|
||||
}
|
||||
|
|
Reference in a new issue