DEV Community

Cover image for Autogenerated Swagger Docs for your Express APIs
Muneeb Hussain
Muneeb Hussain

Posted on

2

Autogenerated Swagger Docs for your Express APIs

πŸš€ Swagger (OpenAPI 3) Autogenerated Docs feature is now available in the "TypeScript Backend Toolkit."

The best part? You only need to do one thing to get this feature. Just replace the Express Router with MagicRouter API, and that's it! Now you can define your Request and Response types using Zod schemas.

Highlights of MagicRouter API:

  • Autogenerates Swagger (OpenAPI 3) Docs based on route information.
  • Validates, serializes, transforms, and defines request and response types using Zod schemas.

More Improvements:

  • Better async handling thanks to express-async-handler, no more try-catch blocks in the controller.
  • Enhanced error handling with a Global Error Handler.
  • Swagger UI (accessible at "/api-docs") for testing your APIs directly in your browser.
  • Removed JSONs to reduce build size.

That's it! I appreciate your feedback.

πŸ‘‰ Checkout the repo

Note: You can check the Implementation of MagicRouter API in the User and Auth Module.

Billboard image

Deploy and scale your apps on AWS and GCP with a world class developer experience

Coherence makes it easy to set up and maintain cloud infrastructure. Harness the extensibility, compliance and cost efficiency of the cloud.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay