Added docs; started README; started ivago

This commit is contained in:
Jef Roosens 2021-03-11 20:52:30 +01:00
parent 1ff5682fd9
commit ba5d149a60
Signed by: Jef Roosens
GPG key ID: B580B976584B5F30
8 changed files with 44 additions and 27 deletions

9
src/ivago/controller.rs Normal file
View file

@ -0,0 +1,9 @@
/// Searches the Ivago API for streets in the given city
///
/// # Arguments
///
/// * `street` -name of the street
/// * `city` - city the street is in
pub fn search_streets(street: String, city: String) -> Vec<String> {
Vec::new()
}

View file

@ -1,22 +1,23 @@
#[cfg(test)] mod tests;
// use rocket_contrib::json::Json;
// use rocket::Route;
use http::{Request, Response};
mod controller;
use controller as ctrl;
pub fn routes() -> Vec<rocket::Route> {
routes![search_streets]
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();
// // 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());
// let response = send(request.body(()).unwrap());
"".to_string()
}