Example Node API application with automatic generated Swagger documentation
Uses TSOA to generate swagger documentation based on decorated controllers and models. Provides a well structured Node API with type checked models and business logic with documentation aiding external parties to consume it.
- [NodeJS] (v14+)
- [Typescript]
- TSOA
app
- the source of our core app code.app/main.ts
- start script for Expressapp/controllers
- controllers for APIapp/models
- interfaces for request/response objects used by controllersapp/services
- services used by controllersapp/routes
- router module on a path in the main app.app/routes/index.ts
- the middleman for handling all requests and getting routes.app/utils
- common functions that are often usedtsconfig.json
- TypeScript config fortsc
compile used to generate Javascripttsoa.json
- TSOA config, see here for detailsdist
- folder for generate JavaScriptpublic/swagger.json
- TSOA generated swagger doc from commandnpm run-script swagger
npm install
npm start:dev # http://localhost:8000/docs