Swagger Node.js projects documentation (automatic with TSOA)

MD
R
Markdown

Build swagger-compliant REST APIs using TypeScript and Node. https://github.com/lukeautry/tsoa

Installation

npm install tsoa --save

Npm script

"scripts": { "docs": "tsoa swagger" }

tsoa.json

{
  "swagger": {
    "outputDirectory": "./docs/swagger-ui",
    "entryFile": "./src/app.ts",
    "host": "localhost:8080",
    "basePath": ""
  },
  "routes": {
    "basePath": "",
    "entryFile": "./src/server.ts",
    "routesDir": "./src"
  }
}

Service File Example:

import * as express from 'express';
import { Get, Post, Route, Body, Query, Header, Path, SuccessResponse, Controller } from 'tsoa';

class ImageService {
  @Get()
  public getArticles() {


  }
}

Created on 5/29/2018