Menu

1 / 2

A better way to create Swagger Docs for Koa APIs using decorators?

DEV CommunityΒ·Oghenovo UsiwomaΒ·6 months ago
#8SHp5ERJ
#node#comment#koa#swagger#typescript
Reading 0:00
15s threshold

Hello there!πŸ‘‹ I just did something to ease documentation for Koa APIs and I'm going to share it with you. If you are a fan of typescript's decorators or you are figuring out how to use them then you'll probably love this.

So, I had to setup swagger docs for a Koa API recently and I had to cram a lot of information and definitions into comments for the swagger-jsdoc tool to extract. As a developer who has used NestJS and is familiar with the ease at which you can create Swagger docs, I disliked this experience. I did check for some alternatives and found one notable package koa-swagger-decorator but why not re-invent the wheel πŸ˜ƒ? I just wanted to code this myself...…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.