Skip to content

CugeDe/rocket-config

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rocket-config

rocket-config is a Fairing designed for Rocket, a web framework for Rust (nightly).

#![feature(proc_macro_hygiene)]

#[macro_use] extern crate rocket;
extern crate rocket_config;
#[macro_use] extern crate rocket_config_codegen;

// This will generate the DieselConfiguration struct
// used below.
configuration!("diesel");

use rocket_config::Factory as ConfigurationsFairing;

// Here, `_configuration` contains the parsed configuration
// file "diesel.{json,yml,yaml}"
#[get("/<name>/<age>")]
fn hello(_configuration: DieselConfiguration, name: String, age: u8)
-> String
{
    format!("Hello, {} year old named {}!", age, name)
}

fn main() {
    rocket::ignite()
        .attach(ConfigurationsFairing::new())
        .mount("/hello", routes![hello]).launch();
}

About

rocket-config is a Fairing designed for Rocket, a web framework for Rust (nightly).

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Languages