mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-23 02:27:40 +08:00
change route to service<resource>
This commit is contained in:
parent
3b601f615a
commit
01b09c065b
@ -90,13 +90,13 @@ pub fn dashboard(config: &mut web::ServiceConfig, enable_frontend: bool) {
|
||||
}
|
||||
config.service(scope);
|
||||
} else {
|
||||
config.route("/", web::get().to(routes::running));
|
||||
config.service(web::resource("/").route(web::get().to(routes::running)));
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "mini-dashboard"))]
|
||||
pub fn dashboard(config: &mut web::ServiceConfig, _enable_frontend: bool) {
|
||||
config.route("/", web::get().to(routes::running));
|
||||
config.service(web::resource("/").route(web::get().to(routes::running)));
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
|
@ -38,21 +38,21 @@ struct DocumentParam {
|
||||
|
||||
pub fn services(cfg: &mut web::ServiceConfig) {
|
||||
cfg.service(
|
||||
web::resource("/indexes/{index_uid}/documents")
|
||||
.route(web::get().to(get_all_documents))
|
||||
.route(web::post().guard(guard_json).to(add_documents))
|
||||
.route(web::put().guard(guard_json).to(update_documents))
|
||||
.route(web::delete().to(clear_all_documents)),
|
||||
)
|
||||
// this route needs to be before the /documents/{document_id} to match properly
|
||||
.route(
|
||||
"/indexes/{index_uid}/documents/delete-batch",
|
||||
web::post().to(delete_documents),
|
||||
)
|
||||
.service(
|
||||
web::resource("/indexes/{index_uid}/documents/{document_id}")
|
||||
.route(web::get().to(get_document))
|
||||
.route(web::delete().to(delete_document)),
|
||||
web::scope("/indexes/{index_uid}/documents")
|
||||
.service(
|
||||
web::resource("")
|
||||
.route(web::get().to(get_all_documents))
|
||||
.route(web::post().guard(guard_json).to(add_documents))
|
||||
.route(web::put().guard(guard_json).to(update_documents))
|
||||
.route(web::delete().to(clear_all_documents)),
|
||||
)
|
||||
// this route needs to be before the /documents/{document_id} to match properly
|
||||
.service(web::resource("/delete-batch").route(web::post().to(delete_documents)))
|
||||
.service(
|
||||
web::resource("/{document_id}")
|
||||
.route(web::get().to(get_document))
|
||||
.route(web::delete().to(delete_document)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -7,8 +7,8 @@ use crate::extractors::authentication::{policies::*, GuardedData};
|
||||
use crate::Data;
|
||||
|
||||
pub fn services(cfg: &mut web::ServiceConfig) {
|
||||
cfg.route("/dumps", web::post().to(create_dump))
|
||||
.route("/dumps/{dump_uid}/status", web::get().to(get_dump_status));
|
||||
cfg.service(web::resource("/dumps").route(web::post().to(create_dump)))
|
||||
.service(web::resource("/dumps/{dump_uid}/status").route(web::get().to(get_dump_status)));
|
||||
}
|
||||
|
||||
async fn create_dump(data: GuardedData<Private, Data>) -> Result<HttpResponse, ResponseError> {
|
||||
|
@ -3,7 +3,7 @@ use actix_web::{web, HttpResponse};
|
||||
use crate::error::ResponseError;
|
||||
|
||||
pub fn services(cfg: &mut web::ServiceConfig) {
|
||||
cfg.route("/health", web::get().to(get_health));
|
||||
cfg.service(web::resource("/health").route(web::get().to(get_health)));
|
||||
}
|
||||
|
||||
async fn get_health() -> Result<HttpResponse, ResponseError> {
|
||||
|
@ -20,13 +20,13 @@ pub fn services(cfg: &mut web::ServiceConfig) {
|
||||
.route(web::put().to(update_index))
|
||||
.route(web::delete().to(delete_index)),
|
||||
)
|
||||
.route(
|
||||
"/indexes/{index_uid}/updates",
|
||||
web::get().to(get_all_updates_status),
|
||||
.service(
|
||||
web::resource("/indexes/{index_uid}/updates")
|
||||
.route(web::get().to(get_all_updates_status))
|
||||
)
|
||||
.route(
|
||||
"/indexes/{index_uid}/updates/{update_id}",
|
||||
web::get().to(get_update_status),
|
||||
.service(
|
||||
web::resource("/indexes/{index_uid}/updates/{update_id}")
|
||||
.route(web::get().to(get_update_status))
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@ use crate::extractors::authentication::{policies::*, GuardedData};
|
||||
use crate::Data;
|
||||
|
||||
pub fn services(cfg: &mut web::ServiceConfig) {
|
||||
cfg.route("/keys", web::get().to(list));
|
||||
cfg.service(web::resource("/keys").route(web::get().to(list)));
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
|
@ -8,9 +8,9 @@ use crate::routes::IndexParam;
|
||||
use crate::Data;
|
||||
|
||||
pub fn services(cfg: &mut web::ServiceConfig) {
|
||||
cfg.route("/indexes/{index_uid}/stats", web::get().to(get_index_stats))
|
||||
.route("/stats", web::get().to(get_stats))
|
||||
.route("/version", web::get().to(get_version));
|
||||
cfg.service(web::resource("/indexes/{index_uid}/stats").route(web::get().to(get_index_stats)))
|
||||
.service(web::resource("/stats").route(web::get().to(get_stats)))
|
||||
.service(web::resource("/version").route(web::get().to(get_version)));
|
||||
}
|
||||
|
||||
async fn get_index_stats(
|
||||
|
Loading…
Reference in New Issue
Block a user