Started search functionality

master
Jef Roosens 2021-03-06 00:25:40 +01:00
parent 28aab01e77
commit 25eaf77713
Signed by: Jef Roosens
GPG Key ID: 955C0660072F691F
3 changed files with 39 additions and 6 deletions

View File

@ -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());
}

View File

@ -1 +0,0 @@
mod ivago.routes;

View File

@ -3,11 +3,23 @@
#[macro_use] extern crate rocket; #[macro_use] extern crate rocket;
mod hello; mod hello;
mod ivago;
fn main() { fn rocket() -> rocket::Rocket {
rocket::ignite().mount("/hello", routes![ rocket::ignite()
.mount(
"/hello",
routes![
hello::world, hello::world,
hello::hello, hello::hello,
hello::name_age hello::name_age
]).launch(); ]
).mount(
"/ivago",
ivago::routes()
)
}
fn main() {
rocket().launch();
} }