scottie1984 / swagger-ui-express

Adds middleware to your express app to serve the Swagger UI bound to your Swagger document. This acts as living documentation for your API hosted from within your app.
MIT License
1.4k stars 225 forks source link

feature: ability to serve the docs as a single-file #357

Open paras-verma opened 11 months ago

paras-verma commented 11 months ago

wanted to add authentication middlewares (w/ bearer-auth) to the endoint where we serve swagger-ui's content

but seeing as the html file imports other assets, including the most curicial one swagger-ui-init.js, this doesn't seem feasible so how about a handler that can serve all the content as a single-file?

currently I have hacked a solution at work buy using serveFiles method and calling it with dummy a request object do let me know if you'd be open to adding such a method! I can then raise a PR

paras-verma commented 11 months ago

@scottie1984 thanks for this project!

please also have a look at #265, seems like there is a need for such a method/middleware