Started search functionality
							parent
							
								
									28aab01e77
								
							
						
					
					
						commit
						25eaf77713
					
				| 
						 | 
					@ -0,0 +1,22 @@
 | 
				
			||||||
 | 
					#[cfg(test)] mod tests;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// use rocket_contrib::json::Json;
 | 
				
			||||||
 | 
					// use rocket::Route;
 | 
				
			||||||
 | 
					use http::{Request, Response};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					pub fn routes() -> Vec<rocket::Route> {
 | 
				
			||||||
 | 
					    routes![search_streets]
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// URL: https://www.ivago.be/nl/particulier/autocomplete/garbage/streets?q=Lange
 | 
				
			||||||
 | 
					#[get("/search?<street>")]
 | 
				
			||||||
 | 
					pub fn search_streets(street: String) -> String {
 | 
				
			||||||
 | 
					    // Build the request
 | 
				
			||||||
 | 
					    let mut request = Request::get(
 | 
				
			||||||
 | 
					        "https://www.ivago.be/nl/particulier/autocomplete/garbage/streets")
 | 
				
			||||||
 | 
					        .body(())
 | 
				
			||||||
 | 
					        .unwrap();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    let response = send(request.body(()).unwrap());
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -1 +0,0 @@
 | 
				
			||||||
mod ivago.routes;
 | 
					 | 
				
			||||||
							
								
								
									
										22
									
								
								src/main.rs
								
								
								
								
							
							
						
						
									
										22
									
								
								src/main.rs
								
								
								
								
							| 
						 | 
					@ -3,11 +3,23 @@
 | 
				
			||||||
#[macro_use] extern crate rocket;
 | 
					#[macro_use] extern crate rocket;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
mod hello;
 | 
					mod hello;
 | 
				
			||||||
 | 
					mod ivago;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					fn rocket() -> rocket::Rocket {
 | 
				
			||||||
 | 
					    rocket::ignite()
 | 
				
			||||||
 | 
					        .mount(
 | 
				
			||||||
 | 
					            "/hello",
 | 
				
			||||||
 | 
					            routes![
 | 
				
			||||||
 | 
					                hello::world,
 | 
				
			||||||
 | 
					                hello::hello,
 | 
				
			||||||
 | 
					                hello::name_age
 | 
				
			||||||
 | 
					            ]
 | 
				
			||||||
 | 
					        ).mount(
 | 
				
			||||||
 | 
					            "/ivago",
 | 
				
			||||||
 | 
					            ivago::routes()
 | 
				
			||||||
 | 
					        )
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
fn main() {
 | 
					fn main() {
 | 
				
			||||||
    rocket::ignite().mount("/hello", routes![
 | 
					    rocket().launch();
 | 
				
			||||||
                           hello::world,
 | 
					 | 
				
			||||||
                           hello::hello,
 | 
					 | 
				
			||||||
                           hello::name_age
 | 
					 | 
				
			||||||
    ]).launch();
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue