Questions tagged [tsoa]
36 questions
3
votes
0 answers
tsoa @Route decorator with variable dosen't works in express app
I can't find any information wh @Route decorator doesn't work with a variable instead of "string".
A swagger definition generated with code below is wrong.
export const PATH_GROUP = "/my-path";
export enum PATHS {
GetButtons =…

Bart
- 53
- 6
2
votes
0 answers
Failed to get session data from express session
I was working on a project that have a separate frontend and backend. I use tsoa-express and express session for my authentication(port 4040) and I create a simple frontend(port 5500) for testing.
Backend:
// Session.ts
class Session {
public…

Thomas
- 41
- 2
2
votes
1 answer
Using cookie-parser (express middleware) in TSOA
In an express app, you would use cookie-parser like this:
var express = require('express')
var cookieParser = require('cookie-parser')
var app = express()
app.use(cookieParser())
app.get('/', function (req, res) {
// Cookies that have not been…

Moose
- 21
- 1
2
votes
0 answers
Express + TSOA + Passport
I am new to Passport and to TSOA. I am trying to migrate an old Express route to TSOA controllers but I have not any idea how to achieve this. I did not find any documentation regarding this, in fact, I found this issue but I think I need a…

Maramal
- 3,145
- 9
- 46
- 90
2
votes
2 answers
Using sendFile within tsoa controller
I want to create an endpoint that sends back the content of a file using sendFile.
Writing the route on my own in my Express application, I know what to do and it works:
app.get('/api/logs', (req, res) => {
var path = require('path');
…

user
- 117
- 9
1
vote
1 answer
TSOA generates Typescript Pick, Partial and Omit schemas in swagger.json file
I have been following the 'Getting started' guide from TSOA to setup a new express project with typescript, add a nodemon configuration and swagger documentation. After finishing step three "Live reloading" the result should be a GET and POST route…

Thore
- 1,918
- 2
- 25
- 50
1
vote
2 answers
How to resolve path issues with tsoa-generated routes and compiled TypeScript files?
I am relatively new to TypeScript and the compilation process, so please bear with me if I am missing something obvious.
I have an express API written in TypeScript using tsoa decorators to generate docs from the code.
In my app the source code is…

salvob
- 121
- 2
- 11
1
vote
0 answers
tsoa swagger docs for express RequestHandler endpoints
Here is a controller endpoint code for which I'm trying to make use of tsoa for the generation of swagger documentation. tsoa works for endpoints' class methods with simple query/path parameters, however, this approach is pretty different.
In the…

Igor Micev
- 1,514
- 1
- 17
- 23
1
vote
0 answers
When to build routes and API spec with TSOA
I am trying to implement TSOA with an existing HapiJS server and would like some insight on the best approach.
You can run tsoa spec-and-routes to generate routes.ts and swagger.json. However, running this manually before running the node process is…

kenwilde
- 121
- 8
1
vote
1 answer
TypeError: (0 , tsoa_1.Get) is not a function
I'm using tsconfig-paths and tsoa in a project. I used tsconfig-paths following with document.
Please get code here.
I got error after running debug:
/home/tailt/.nvm/versions/node/v19.1.0/bin/node -r…

Tai Lu
- 43
- 7
1
vote
0 answers
Avoid infered response type in generated swagger.json with TSOA (Express)
I'm using TSOA to auto-generate a swagger.json file which will be rendered with swagger-ui-express
The problem is that, although the endpoint really returns a status code 200 and a response object, TSOA is interpreting that the execute() method does…

Pablo León
- 241
- 4
- 17
1
vote
0 answers
TSOA FormField Array of String request
I'm trying to generate a route that passes a file plus some additional parameters to a controller as follows:
myController(
@FormField() name: string,
@FormField() cnpj: string,
@FormField() sector: string,
@FormField() size: string,
@FormField()…
1
vote
1 answer
TypeScript and TSOA : Error Code LIMIT_UNEXPECTED_FILE with multiple @UploadedFile
I build a Rest API using typescript and TSOA with Express.
In a route, I try to receive multiple formfields (using the decorator @FormField) and multiple file fields (using the e decorator @UploadedFile).
see official link :…

Aissam Jadli
- 75
- 11
1
vote
2 answers
How to use csurf middleware in tsoa express?
I am new to tsoa and I want to do CSRF implementation in my node app. I have been able to make api using app.use() but I want to write in tsoa. Is there any way?

Sammy
- 15
- 6
1
vote
0 answers
Tsoa/Typescript hanging when generating spec and routes
I was experimenting setting up an API using TSOA and swagger-ui-express.
After working for a while where everything was working great, the tsoa spec-and-routes command all of a sudden got stuck.
After rolling the code back and forth to try to…

Rúni Egholm Vørmadal
- 11
- 2