Forum Discussion

harryboy's avatar
harryboy
Occasional Contributor
6 years ago

Enable swagger to listen on IP address instead of localhost.

I have installed Swagger Editor on my Ubuntu 16.04 OS by doing the following steps:

 

1. sudo apt-get install nodejs-legacy
2. git clone https://github.com/swagger-api/swagger-editor.git
3. sudo apt-get install npm
4. cd swagger-editor
5. npm start
6. I edited the APIs I wanted using Swagger Editor
7. I generated a NodeJS Server from Swagger Editor Menu
8. I extracted my server zip file and CD into it.
9. npm install connect
10. npm install swagger-tools
11. npm install js-yaml 
12. node index.js             <-- START MY SERVER

Result is:

me@ubuntu:~/Downloads/nodejs-server-server$ node index.js
Your server is listening on port 8081 (http://localhost:8081)
Swagger-ui is available on http://localhost:8081/docs

Question: You see here that its listening only on localhost.

How do I get the server to listen on the actual IP address of my Server e.g. 10.12.13.23 and not localhost?

As I want to access it from another PC?

No RepliesBe the first to reply