Skip to main content

tsoa

A Wing library for working with TSOA - An OpenAPI-compliant Web APIs using TypeScript.

Prerequisites

Installation

npm i @winglibs/tsoa

Usage

// main.w
bring tsoa;

let service = new tsoa.Service(
controllerPathGlobs: ["./src/*Controller.ts"],
outputDirectory: "../build",
routesDir: "../build"
);

It is also possible to use Wing resources from the TS code

let bucket = new cloud.Bucket();
service.lift(bucket, id: "bucket", allow: ["put"]);
// someController.ts ...
import { lifted } from "@winglibs/tsoa/clients.js";

@Get("{userId}")
public async getUser(
@Path() userId: number,
@Request() request: Req,
@Query() name?: string,
): Promise<User> {
let bucket = lifted("bucket");
await bucket.put(userId.toString(), name ?? "not-a-name");

return {
id :userId,
name: name ?? "not-a-name",
status: "Happy",
email:"email",
phoneNumbers: ["a"]
}
}

Roadmap

License

This library is licensed under the MIT License.

API Reference

Table of Contents

Service_tfaws (preflight class)

No description

Constructor

new(props: ServiceProps): Service_tfaws

Properties

NameTypeDescription
specFilestrNo description
urlstrNo description

Methods

SignatureDescription
lift(client: Resource, ops: LiftOptions): voidNo description

Service_sim (preflight class)

No description

Constructor

new(props: ServiceProps): Service_sim

Properties

NameTypeDescription
specFilestrNo description
urlstrNo description

Methods

SignatureDescription
lift(client: Resource, ops: LiftOptions): voidNo description

Service (preflight class)

No description

Constructor

new(props: ServiceProps): Service

Properties

NameTypeDescription
specFilestrNo description
urlstrNo description

Methods

SignatureDescription
lift(client: Resource, ops: LiftOptions): voidNo description

IService (interface)

No description

Properties

No properties

Methods

SignatureDescription
lift(client: Resource, ops: LiftOptions): voidNo description

LiftOptions (struct)

No description

Properties

NameTypeDescription
allow
Array
No description
idstrNo description

ServiceProps (struct)

No description

Properties

NameTypeDescription
controllerPathGlobs
Array
No description
entryFilestr?No description
outputDirectorystrNo description
routesDirstrNo description
specSpecProps?No description
watchDirstr?No description

SpecProps (struct)

No description

Properties

NameTypeDescription
outputDirectorystr?No description
specVersionnum?No description

StartServiceOptions (struct)

No description

Properties

NameTypeDescription
basedirstrNo description
clients
Map
No description
currentdirstrNo description
homeEnvstrNo description
lastPortstr?No description
optionsServicePropsNo description
pathEnvstrNo description
workdirstrNo description