lukeautry / tsoa

Build OpenAPI-compliant REST APIs using TypeScript and Node
MIT License
3.42k stars 489 forks source link

support for multiple server #1524

Closed adamchengtkc closed 7 months ago

adamchengtkc commented 8 months ago

I have two sets of controller that I would like to serve on two different ports. I have looked at https://github.com/lukeautry/tsoa/issues/713 but it seems to focus on generating spec.

I have tried manually importing controller according to https://tsoa-community.github.io/docs/routes.html but the second app would come in empty

Sorting

Expected Behavior

Like in vanilla express, possibility to run two separate server on different ports

const app = express();
app.listen(6001, () =>
  console.log(`Serving at port 6001`)
);
const app2 = express();
app2.listen(6001, () =>
  console.log(`Serving at port 6001`)
);

Current Behavior

I have tried manually importing controller according to https://tsoa-community.github.io/docs/routes.html but the second app would come in empty

import "./controller/app"
const app= express()
RegisterRoutes(app)
app.listen(6000, () =>
  console.log(`Serving at port 6001`)
);

import "./controller/app1"
const app1= express()
RegisterRoutes(app1)
app1.listen(6001, () =>
  console.log(`Serving at port 6001`)
);

Possible Solution

Steps to Reproduce

      1. 4.

Context (Environment)

Version of the library: 20.9.0 Version of NodeJS: 5.1.1

Detailed Description

Breaking change?

github-actions[bot] commented 7 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days