Skip to content

How to integrate a spec from constructing OpenAPI into an endpoint #727

Answered by RobinTail
lpw asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @lpw ,

I never tried using swagger-ui-express, but reading its documentation I figured out that it consists of two parts: some express middleware and the handler that serves an HTML page, so that route is not a part of the API.

In this regard, I believe, you should switch to custom app approach and attachRouting() method instead of createServer().

You should create your own express app, apply app.use() the way swagger-ui-express recommends, then attachRouting() and start listening the requests. Check out the example in the Readme.

Please try this approach and let me know if it works.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@lpw
Comment options

Answer selected by RobinTail
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants