...
This commit is contained in:
@@ -10,6 +10,7 @@ use serde_json::json;
|
||||
use log::{error, info};
|
||||
use utoipa::OpenApi;
|
||||
use utoipa_redoc::{Redoc, Servable};
|
||||
use utoipa_swagger_ui::SwaggerUi;
|
||||
|
||||
use crate::ACLDB;
|
||||
use crate::rpc::{RpcInterface, RpcRequest, RpcResponse, AclUpdateParams, AclRemoveParams, AclDelParams, SetParams, DelParams, GetParams, PrefixParams};
|
||||
@@ -165,6 +166,7 @@ impl Server {
|
||||
|
||||
info!("Starting ACLDB server on {}:{}", self.config.host, self.config.port);
|
||||
info!("API documentation available at: http://{}:{}/redoc", self.config.host, self.config.port);
|
||||
info!("Swagger UI available at: http://{}:{}/swagger", self.config.host, self.config.port);
|
||||
|
||||
// Start the HTTP server
|
||||
HttpServer::new(move || {
|
||||
@@ -182,6 +184,10 @@ impl Server {
|
||||
.service(
|
||||
Redoc::with_url("/redoc", serde_json::to_value(ApiDoc::openapi()).unwrap())
|
||||
)
|
||||
.service(
|
||||
SwaggerUi::new("/swagger/{_:.*}")
|
||||
.url("/api-docs/openapi.json", ApiDoc::openapi())
|
||||
)
|
||||
})
|
||||
.bind(format!("{0}:{1}", self.config.host, self.config.port))?
|
||||
.run()
|
||||
|
Reference in New Issue
Block a user