From 1643d7a6636296566aba744e67cdffb072f0251a Mon Sep 17 00:00:00 2001 From: DrRac27 <41861089+DrRac27@users.noreply.github.com> Date: Sun, 19 Nov 2023 02:09:40 +0100 Subject: [PATCH] fix quickstart example (#691) Co-authored-by: Sunli <sunlipad4@icloud.com> --- poem-openapi/src/lib.rs | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/poem-openapi/src/lib.rs b/poem-openapi/src/lib.rs index 227cbc96a7..b2bd86e6c5 100644 --- a/poem-openapi/src/lib.rs +++ b/poem-openapi/src/lib.rs @@ -55,16 +55,17 @@ //! } //! } //! -//! let api_service = -//! OpenApiService::new(Api, "Hello World", "1.0").server("http://localhost:3000"); -//! let ui = api_service.swagger_ui(); -//! let app = Route::new().nest("/", api_service).nest("/docs", ui); -//! -//! # tokio::runtime::Runtime::new().unwrap().block_on(async { -//! Server::new(TcpListener::bind("0.0.0.0:3000")) -//! .run(app) -//! .await; -//! # }); +//! #[tokio::main] +//! async fn main() { +//! let api_service = +//! OpenApiService::new(Api, "Hello World", "1.0").server("http://localhost:3000"); +//! let ui = api_service.swagger_ui(); +//! let app = Route::new().nest("/", api_service).nest("/docs", ui); +//! +//! Server::new(TcpListener::bind("127.0.0.1:3000")) +//! .run(app) +//! .await; +//! } //! ``` //! //! ## Check it