|
|
@ -1,3 +1,4 @@
|
|
|
|
|
|
|
|
use actix_cors::Cors;
|
|
|
|
use utils::error::Result;
|
|
|
|
use utils::error::Result;
|
|
|
|
|
|
|
|
|
|
|
|
use actix_web::{get, http::header, web, App, HttpResponse, HttpServer, Responder};
|
|
|
|
use actix_web::{get, http::header, web, App, HttpResponse, HttpServer, Responder};
|
|
|
@ -72,13 +73,14 @@ async fn route_query_index(path: web::Path<(String, usize)>) -> Result<impl Resp
|
|
|
|
|
|
|
|
|
|
|
|
#[actix_web::main]
|
|
|
|
#[actix_web::main]
|
|
|
|
async fn main() -> std::io::Result<()> {
|
|
|
|
async fn main() -> std::io::Result<()> {
|
|
|
|
HttpServer::new(|| {
|
|
|
|
HttpServer::new(||
|
|
|
|
App::new()
|
|
|
|
App::new()
|
|
|
|
.service(route_query_list)
|
|
|
|
.service(route_query_list)
|
|
|
|
.service(route_query)
|
|
|
|
.service(route_query)
|
|
|
|
.service(route_query_random)
|
|
|
|
.service(route_query_random)
|
|
|
|
.service(route_query_index)
|
|
|
|
.service(route_query_index)
|
|
|
|
})
|
|
|
|
.wrap(Cors::permissive())
|
|
|
|
|
|
|
|
)
|
|
|
|
.bind(("127.0.0.1", Args::parse().port))?
|
|
|
|
.bind(("127.0.0.1", Args::parse().port))?
|
|
|
|
.run()
|
|
|
|
.run()
|
|
|
|
.await
|
|
|
|
.await
|
|
|
|