Document Restful API created in Node.JS

1.3k views Asked by At

I have created Restful APIs in Node.js and now I plan to document them so they can be shared with others. I spent the past couple of days researching in to this and I found Swagger and started exploring what it had to offer. I really like Swagger-UI, It takes a JSON object and generates a document as displayed by this Demo. Another option is using the Swagger-Editor however this means writing out manually and I am not interested in that.

So basically I feel if I can generate the JSON object based on docstrings/comments I write in my api .js files I can then simply pass the JSON in to swagger-UI and have my beautiful document. I was looking for some tool that can help me achieve this. Any tool or tutorial would help out a lot. I have looked at all the tools listed on Swagger Open Source Integration Section.

Perhaps I missed something but would definitely appreciate if someone can point me in the right direction. I am not interested in design first approach etc. I already have existing APIs and would like to generate documents for them. I highly appreciate prompt replies from experienced users as I am really stuck on this. I have no sense of direction right now.

Additional Notes

I guess a perhaps a tool that can even help me create that JSON object would be a good idea but I do feel I might have missed something since swagger is so popular I am sure this must be done before.

1

There are 1 answers

1
user1010101 On BEST ANSWER

So I have found a really nice tool that does exactly what i want. I hope others can find this post useful. I found something called api-doc swagger. It utilizes api-doc which converts docstrings in to a json object. This api-doc swagger tool goes further and converts that json object in to swagger json format which you can then pass in to the swagger-ui.