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