Skip to content

Instantly share code, notes, and snippets.

@goyox86
Created February 23, 2017 13:35
Show Gist options
  • Save goyox86/a38cb7a26e21dbee89b7cc25ae8c088f to your computer and use it in GitHub Desktop.
Save goyox86/a38cb7a26e21dbee89b7cc25ae8c088f 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();
let api_v1_routes = 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];
rocket::ignite()
.mount("/api/v1", api_v1_routes)
.manage(db)
.launch()
}
// I'm getting this
⇒ cargo build
Compiling blog v0.1.0 (file:///Users/goyox86/Code/rust/blog)
warning: the 'api_v1_posts_index' route is not mounted
--> src/endpoints/api_v1/posts.rs:20:1
|
20 | fn api_v1_posts_index(db: State<Db>) -> EndpointResult<JSON<Value>> {
| _^ starting here...
21 | | let conn = &*db.pool().get().unwrap();
22 | |
23 | | posts.filter(published.eq(false))
24 | | .load::<Post>(conn)
25 | | .map(|results| JSON(json!(results)))
26 | | .map_err(|err| EndpointError::Db(err))
27 | | }
| |_^ ...ending here
|
= note: #[warn(unmounted_route)] on by default
= note: Rocket will not dispatch requests to unmounted routes.
help: maybe add a call to `mount` here?
--> src/main.rs:48:5
|
48 | rocket::ignite()
| ^^^^^^^^^^^^^^^^
warning: the 'api_v1_posts_create' route is not mounted
--> src/endpoints/api_v1/posts.rs:30:1
|
30 | fn api_v1_posts_create(db: State<Db>,
| ^
|
= note: #[warn(unmounted_route)] on by default
= note: Rocket will not dispatch requests to unmounted routes.
help: maybe add a call to `mount` here?
--> src/main.rs:48:5
|
48 | rocket::ignite()
| ^^^^^^^^^^^^^^^^
warning: the 'api_v1_posts_show' route is not mounted
--> src/endpoints/api_v1/posts.rs:44:1
|
44 | fn api_v1_posts_show(post_id: i32, db: State<Db>) -> EndpointResult<Response> {
| ^
|
= note: #[warn(unmounted_route)] on by default
= note: Rocket will not dispatch requests to unmounted routes.
help: maybe add a call to `mount` here?
--> src/main.rs:48:5
|
48 | rocket::ignite()
| ^^^^^^^^^^^^^^^^
warning: the 'api_v1_posts_update' route is not mounted
--> src/endpoints/api_v1/posts.rs:60:1
|
60 | fn api_v1_posts_update(db: State<Db>,
| ^
|
= note: #[warn(unmounted_route)] on by default
= note: Rocket will not dispatch requests to unmounted routes.
help: maybe add a call to `mount` here?
--> src/main.rs:48:5
|
48 | rocket::ignite()
| ^^^^^^^^^^^^^^^^
warning: the 'api_v1_posts_destroy' route is not mounted
--> src/endpoints/api_v1/posts.rs:83:1
|
83 | fn api_v1_posts_destroy(post_id: i32, db: State<Db>) -> EndpointResult<Response> {
| ^
|
= note: #[warn(unmounted_route)] on by default
= note: Rocket will not dispatch requests to unmounted routes.
help: maybe add a call to `mount` here?
--> src/main.rs:48:5
|
48 | rocket::ignite()
| ^^^^^^^^^^^^^^^^
^C
goyox86@15317-jnarvaez:~/Code/rust/blog|goyox86/more-work-on-errors⚡
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment