# Node-red-node-swagger and node-red-constrib-http-custom-port

**URL:** <https://discourse.nodered.org/t/node-red-node-swagger-and-node-red-constrib-http-custom-port/62739>\
**Category:** General\
**Created:** [17 May 2022 10:48 UTC](https://discourse.nodered.org/t/node-red-node-swagger-and-node-red-constrib-http-custom-port/62739 "2022-05-17T10:48:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![flipzz](https://avatars.discourse-cdn.com/v4/letter/f/bb73d2/32.png) [@flipzz](https://discourse.nodered.org/u/flipzz)\
**Post date:** [17 May 2022 10:48 UTC](https://discourse.nodered.org/t/node-red-node-swagger-and-node-red-constrib-http-custom-port/62739/1 "2022-05-17T10:48:33Z")

</div>

Hi,

I am trying to get node-red-node-swagger to generate swagger documentation. I can get it working for a HTTP IN node but not the node-red-constrib-http-custom-port on a custom port. Any ideas?

````auto
    {
        "id": "636df2a183b16ff4",
        "type": "node-red-contrib-http-custom-port",
        "z": "e18f95efaa76815e",
        "name": "",
        "url": "/api/testNotVisible",
        "method": "post",
        "upload": false,
        "swaggerDoc": "6699d3b594113217",
        "port": "8080",
        "x": 590,
        "y": 260,
        "wires": [
            [
                "fb9d66179dae2cfe"
            ]
        ]
    },
    {
        "id": "fb9d66179dae2cfe",
        "type": "http response",
        "z": "e18f95efaa76815e",
        "name": "",
        "statusCode": "200",
        "headers": {
            "status": "ok"
        },
        "x": 1100,
        "y": 260,
        "wires": []
    },
    {
        "id": "bd1ddf843cfa518c",
        "type": "http in",
        "z": "e18f95efaa76815e",
        "name": "",
        "url": "/api/visible",
        "method": "post",
        "upload": false,
        "swaggerDoc": "14749f632af54b53",
        "x": 560,
        "y": 340,
        "wires": [
            [
                "ab504247fdc63bd2"
            ]
        ]
    },
    {
        "id": "ab504247fdc63bd2",
        "type": "http response",
        "z": "e18f95efaa76815e",
        "name": "",
        "statusCode": "200",
        "headers": {
            "status": "ok"
        },
        "x": 1100,
        "y": 340,
        "wires": []
    },
    {
        "id": "6699d3b594113217",
        "type": "swagger-doc",
        "summary": "Not visible",
        "description": "Test API not visible in Swagger",
        "tags": "",
        "consumes": "",
        "produces": "",
        "parameters": [
            {
                "name": "x-api-key",
                "in": "header",
                "description": "the api-key",
                "required": true,
                "type": "string"
            }
        ],
        "responses": {
            "200": {
                "description": "Successful"
            }
        },
        "deprecated": false
    },
    {
        "id": "14749f632af54b53",
        "type": "swagger-doc",
        "summary": "API Visible",
        "description": "API Visible in Swagger",
        "tags": "",
        "consumes": "",
        "produces": "",
        "parameters": [],
        "responses": {},
        "deprecated": false
    }
] ```
````

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [17 May 2022 11:19 UTC](https://discourse.nodered.org/t/node-red-node-swagger-and-node-red-constrib-http-custom-port/62739/2 "2022-05-17T11:19:22Z")

</div>

You will probably need to ask the author of that node.

There are a couple of other alternatives depending on what you actually want to achieve.

1. Use a reverse proxy such as NGINX or Caddy to listen on an alternative port but proxy the requests through to Node-RED's port.
2. Use uibuilder which allows for a different ExpressJS server with control over ExpressJS settings.

---

<div class="post-metadata">

**Author:** ![shrickus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/shrickus/32/517_2.png) [@shrickus](https://discourse.nodered.org/u/shrickus)\
**Post date:** [17 May 2022 19:47 UTC](https://discourse.nodered.org/t/node-red-node-swagger-and-node-red-constrib-http-custom-port/62739/3 "2022-05-17T19:47:46Z")

</div>

> [@flipzz](#):
>
> I can get it working for a HTTP IN node

Yes, the swagger plug-in is hard-coded to search through your flows for flows that start with an `http in` node, and terminate with an `http response` node. The code will not find any other endpoints, nor will it find flows that are connected through `link out` / `link in` pairs. It is a limitation that I've thought about fixing in the past, but never actually done.

A better implementation may be to inspect the express endpoints, so contributed nodes could (maybe) be included, but features related to swagger are not used enough to get any development attention -- so they wait for one of us to fix and contribute back.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [17 May 2022 20:31 UTC](https://discourse.nodered.org/t/node-red-node-swagger-and-node-red-constrib-http-custom-port/62739/4 "2022-05-17T20:31:58Z")

</div>

In that case Steve, my option 1 above would probably be the best work-around.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [16 July 2022 20:32 UTC](https://discourse.nodered.org/t/node-red-node-swagger-and-node-red-constrib-http-custom-port/62739/5 "2022-07-16T20:32:18Z")

</div>

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