Add Swagger-UI To Existing NodeJS TypeScript API

Channel:
Subscribers:
25,200
Published on ● Video Link: https://www.youtube.com/watch?v=qemG0CWOx1I



Duration: 21:26
58,705 views
504


Code : https://github.com/Sean-Bradley/Seans-TypeScript-NodeJS-CRUD-REST-API-Boilerplate
I have an existing NodeJS API and I want to add Swagger-UI to it. This makes the API look much more professional very quickly.

I also use an extension in VSCode called Swagger Viewer, which helps a lot when writing the swagger.json.

After setting up everything and starting the nodejs api server, the swagger documentation is available at http://localhost:3000/swagger

When importing json files in typescript, you may get an error indicating inability to import json files. To fix, you can add
"resolveJsonModule": true,
"esModuleInterop": true,
to your tsconfig compilerOptions.

If you got this far, you probably like TypeScript just like I do,
I have created a course to teach TypeScript together with Socket.IO so please check it out.
https://youtu.be/3uLSNctzkkw







Tags:
swagger
nodejs
nodejs engineer
typescript
swagger-ui-express
crud
OPENAPI