Swagger path to access directly from browser


I use Node-RED version 1.0.3 and Node.js version 10.18.1
I installed node-red-node-swagger and all is OK.

But, I don`t know what to do to access swagger , directly from browser , like http://localhost:1880/swagger-docs/
I need a clean page, only with swagger.

I tried various changes to the "basePath":"/" in settings.js, without success, I'm sure I'm wrong somewhere.

NodeRed is running on Windows 10.

Have you followed the instructions for setting up this node from the Readme?

Take a look at step 5: "The generated swagger is then available at http://localhost:1880/http-api/swagger.json ."

I don`t need json file.

I searching for something like this : https://petstore.swagger.io/?_ga=2.252125578.2084557169.1580751320-1190130577.1580751320

But with local link , like : http://localhost:1880/swagger-docs/

Have you checked the Readme yet? If you scroll further down it says that the UI (which I assume you’re looking for) is added as sidebar panel. So start looking there.

I probably can't explain it very well, especially since I'm not a native English speaker.
I know that the UI is accessible laterally. What I need is a direct link to the swegger interface. As a separate external link, with no connection to the nodered.

For example, you can access the DashBoard with a direct link, such as!/0. Thus, I only have access to the dashboard.

Basically, I need a link with direct access only for the Swagger UI

Okay, I understand what you mean. I'm not using swagger myself, but I've utilised this interface for published APIs myself before. Looking through the code of the node, take a look at http://localhost:1880/swagger-ui/swagger-ui.html and see if that does the trick. That page is loaded inside an iframe in the sidebar. If that doesn't give the result you're looking for, I'm afraid there's no ready solution. This is what the capabilities of this node are limited to.

Unfortunately it doesn't work ...

In that case I see one more option beyond trying a different node (having no clue if that node would exist): put an http endpoint yourself, method GET. Add a template node, followed by HTTP response. In that template node replicate the way the sidebar swagger UI is set up. Then use that endpoint for your needs.

If the internal ip address works for the dashboard ui, then it should work for swagger as well... try

instead of using localhost (but it's odd that localhost does not work for you) -- are you sure your are running a browser on the same hardware that node-red is running?

Steve, looking at the code I’m seeing now that it might be caused by the iframe looking for parent.swaggerDocUrl to decide how to load it, which is a variable created inside the onPaletteAdd function. Sounds to me that with a bit of a template node it can be set up to use that instead...

Both links respond with me "Cannot GET /swagger-ui/"

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.