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;
|
18
src/main.rs
18
src/main.rs
|
@ -3,11 +3,23 @@
|
|||
#[macro_use] extern crate rocket;
|
||||
|
||||
mod hello;
|
||||
mod ivago;
|
||||
|
||||
fn main() {
|
||||
rocket::ignite().mount("/hello", routes![
|
||||
fn rocket() -> rocket::Rocket {
|
||||
rocket::ignite()
|
||||
.mount(
|
||||
"/hello",
|
||||
routes![
|
||||
hello::world,
|
||||
hello::hello,
|
||||
hello::name_age
|
||||
]).launch();
|
||||
]
|
||||
).mount(
|
||||
"/ivago",
|
||||
ivago::routes()
|
||||
)
|
||||
}
|
||||
|
||||
fn main() {
|
||||
rocket().launch();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue