Comments (2)
Hey,
I just went ahead and implemented my own version using the original source code, which was easy enough.
Here are some of the rough ideas:
fn create_endpoint(spec : &str) -> impl Endpoint {
let ui_html = String::from(swagger_ui::HTML_INDEX).replace("{spec}", spec);
poem::Route::new()
.at("/" , make_sync(move |_| Html(ui_html.clone())))
.at("/oauth2.html", make_sync(move |_| Html(swagger_ui::HTML_OAUTH2)))
}
...
let api_service = OpenApiService::new(...);
let api_ep = api_service
.with(poem::middleware::Cors::new())
...
;
let ui_ep = create_endpoint(&api_service.spec());
let route = Route::new()
.nest("/", api_ep)
.nest("/ui", ui_ep)
;
the HTML_...
consts are just the desired custom html build into the binary with str_include!(...)
.
from poem.
cool. good one. im looking into that. thanks
from poem.
Related Issues (20)
- Acme-alpn does not work
- Multiple 200 OK options?
- Add Typed Multipart Data Extractor to Poem
- Moving from `serde_json` to faster json parser lib
- Transform errors when extract parameters HOT 1
- poem-lambdaV5.0.0 AWS API Gateway triggering lambda is not supported?
- poem-openapi 5.0.1 is incompatible with poem-openapi-derive 5.0.0 HOT 1
- Allow SecurityScheme as Macro parameter of OpenApi or oai
- Middleware examples are out of date
- EmbeddedFilesEndpoint not working for index.html in subdirectory HOT 2
- [poem-openapi] Path parameters in `prefix_path` do not generate the correct openapi specification HOT 1
- Redirect response type error HOT 1
- RequestId Middleware display ERROR Message
- The api doc request response 502 when set the host `0.0.0.0` HOT 1
- Advanced mTLS support
- Correct usage of `CookieJar`, `private` and `private_with_key` HOT 1
- Grpc Build: Format service name as `.{proto_name}` when package is empty
- serve_connection should handle panic?
- Drop `#[derive(Default)]` from handler macro HOT 2
- Merging api specs/different middleware's for different apis with same OpenAPI Specificaton
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from poem.