Menu

πŸ“°
0

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

DEV Community: koaΒ·Oghenovo UsiwomaΒ·about 1 month ago
#8SHp5ERJ
#dev#decorator#code#class#highlight#swagger
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... Thankfully, I got something usable without too much effort but this could easily have turned into a bad situation where I just wasted time and effort instead of using an existing solution. Alright, let's get started!…

Continue reading β€” create a free account

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

Read More