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
-  Support simplatform
- Add Console support for http client (depends on https://github.com/winglang/wing/issues/6131)
-  Support tf-awsplatform using Amazon Api Gateway
-  Support gcpplatform using GCP Api Gateway
License
This library is licensed under the MIT License.
API Reference
Table of Contents
- Classes
- Interfaces
- Structs
Service_tfaws (preflight class) 
No description
Constructor
new(props: ServiceProps): Service_tfaws
Properties
| Name | Type | Description | 
|---|---|---|
| specFile | str | No description | 
| url | str | No description | 
Methods
| Signature | Description | 
|---|---|
| lift(client: Resource, ops: LiftOptions): void | No description | 
Service_sim (preflight class) 
No description
Constructor
new(props: ServiceProps): Service_sim
Properties
| Name | Type | Description | 
|---|---|---|
| specFile | str | No description | 
| url | str | No description | 
Methods
| Signature | Description | 
|---|---|
| lift(client: Resource, ops: LiftOptions): void | No description | 
Service (preflight class) 
No description
Constructor
new(props: ServiceProps): Service
Properties
| Name | Type | Description | 
|---|---|---|
| specFile | str | No description | 
| url | str | No description | 
Methods
| Signature | Description | 
|---|---|
| lift(client: Resource, ops: LiftOptions): void | No description | 
IService (interface) 
No description
Properties
No properties
Methods
| Signature | Description | 
|---|---|
| lift(client: Resource, ops: LiftOptions): void | No description | 
LiftOptions (struct) 
No description
Properties
| Name | Type | Description | 
|---|---|---|
| allow |  | No description | 
| id | str | No description | 
ServiceProps (struct) 
No description
Properties
| Name | Type | Description | 
|---|---|---|
| controllerPathGlobs |  | No description | 
| entryFile | str? | No description | 
| outputDirectory | str | No description | 
| routesDir | str | No description | 
| spec | SpecProps? | No description | 
| watchDir | str? | No description | 
SpecProps (struct) 
No description
Properties
| Name | Type | Description | 
|---|---|---|
| outputDirectory | str? | No description | 
| specVersion | num? | No description | 
StartServiceOptions (struct) 
No description
Properties
| Name | Type | Description | 
|---|---|---|
| basedir | str | No description | 
| clients |  | No description | 
| currentdir | str | No description | 
| homeEnv | str | No description | 
| lastPort | str? | No description | 
| options | ServiceProps | No description | 
| pathEnv | str | No description | 
| workdir | str | No description |