feat: refactor code and add new search functionality
This commit is contained in:
@@ -1,15 +1,6 @@
|
||||
use actix_web::{get, post, HttpResponse, Responder};
|
||||
use actix_web::{get, HttpResponse, Responder};
|
||||
|
||||
#[get("/")]
|
||||
pub async fn say_hello() -> impl Responder {
|
||||
HttpResponse::Ok().body("Hello world!")
|
||||
}
|
||||
|
||||
#[post("/echo")]
|
||||
pub async fn echo(req_body: String) -> impl Responder {
|
||||
HttpResponse::Ok().body(req_body)
|
||||
}
|
||||
|
||||
pub async fn manual_hello() -> impl Responder {
|
||||
HttpResponse::Ok().body("Hey there!")
|
||||
}
|
@@ -24,11 +24,12 @@ async fn main() -> std::io::Result<()> {
|
||||
App::new()
|
||||
// Inject the search engine into the application state
|
||||
.app_data(app_state.clone())
|
||||
|
||||
// enable logger
|
||||
.wrap(Logger::default())
|
||||
|
||||
.service(hello::say_hello)
|
||||
.service(hello::echo)
|
||||
.route("/hey", web::get().to(hello::manual_hello))
|
||||
|
||||
// Search Routes
|
||||
.route(
|
||||
"/search/index/document",
|
||||
|
Reference in New Issue
Block a user