Skip to content

Instantly share code, notes, and snippets.

@goyox86
Last active February 23, 2017 14:10
Show Gist options
  • Save goyox86/75a690492487cbd5446452c4738bbf8d to your computer and use it in GitHub Desktop.
Save goyox86/75a690492487cbd5446452c4738bbf8d to your computer and use it in GitHub Desktop.
fn main() {
let env_str = &std_env::var("BLOG_ENV").unwrap_or(format!("development"));
let env = Env::from_str(env_str).unwrap();
let db_config = DbConfig::load(&env).expect("Error loading DB configuration");
let mut db = Db::new(db_config);
db.init();
rocket::ignite()
.mount("/api/v1", routes![
api_v1::posts::api_v1_posts_index,
api_v1::posts::api_v1_posts_create,
api_v1::posts::api_v1_posts_show,
api_v1::posts::api_v1_posts_update,
api_v1::posts::api_v1_posts_destroy
]).manage(db)
.launch()\
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment