Skip to content

Latest commit

 

History

History
53 lines (34 loc) · 1.66 KB

README.md

File metadata and controls

53 lines (34 loc) · 1.66 KB

Type-Safe API Validation with TSOA and Zod

Welcome to the repository for the article "Supercharge Your API with Type-Safe Validation using TSOA and Zod Decorators", published on Medium. This repo demonstrates how to integrate TSOA and Zod for building robust, type-safe REST APIs in Node.js with runtime validation.

Table of Contents

Overview

In this project, you'll learn how to:

  • Use TSOA for building type-safe REST APIs with TypeScript decorators.
  • Integrate Zod for runtime data validation of API inputs.
  • Create reusable decorators to simplify validation across multiple endpoints.

Prerequisites

Before you begin, make sure you have the following installed:

Installation

  1. Clone the repository:

    git clone https://github.com/pmullot/tsoa-zod-decorators.git
    cd tsoa-zod-decorators```
    
  2. Install the dependencies: npm install

  3. Generate routes, specs and compile: npm run build

Usage

  1. Run the project with: npm start
  2. go to http://localhost:8000/api-docs and try it!!

License

This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0). For more details, please see the LICENSE file.


Happy coding!