You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// src/users/usersController.ts
import {
Body,
Controller,
Get,
Path,
Post,
Query,
Route,
SuccessResponse,
} from "tsoa";
@Route("users")
export class UsersController extends Controller {
@Get("{userId}")
public async getUser(
@Path() userId: number,
@Query() name?: string
): Promise<string> {
return "new UsersService().get(userId, name);"
}
@SuccessResponse("201", "Created") // Custom success response
@Post()
public async createUser(
@Body() requestBody: number
): Promise<void> {
this.setStatus(201); // set return status 201
return;
}
}
./src/wing/subfolder/main.w
bring "../my_api.w" as api;
new api.Service();
./src/wing/my_api.w
bring tsoa;
pub class Service {
new() {
let service = new tsoa.Service(
controllerPathGlobs: ["../controllers/**.ts"],
outputDirectory: "../../build",
routesDir: "../../build"
);
}
}
I tried this:
I tried using the tsoa service from two different entrypoints (different directories).
It turns out that the folder resolution is based on the location of the entrypoint (*.main.w file)
This happened:
currently the tsoa service is dependant on the entrypoint location, which makes it impossible to work with.
I expected this:
to work the same from any place
Is there a workaround?
No response
Anything else?
No response
Wing Version
No response
Node.js Version
No response
Platform(s)
No response
Community Notes
The text was updated successfully, but these errors were encountered: