Comments (5)
Hi @Tlahey,
I don't understand exactly why you need to create two server to build your routes one time again.
You can mount all micro-service on the final server rather than launch a server then stop it and retrieve the built routes. The final result is the same.
Maybe I need an example to understand your need.
See you.
from tsed.
Ok so, i've got a system where I use multiple micro services hosted on different Docker containers. Each of these microservices should be aware of all the routes there is. So we are trying to find a way to instatiate all the routes once to use as a list for our initialisation. But once we have this list we want each of our services to only be aware of the routes hosted on this container.
A quick example
I've got 3 controllers that instantiate 3 endpoints : /a /b /c
We've got one container per controller but we want each container to be aware of all the routes.
We actually need to have the routes in each container but each separate endpoint should only be accessible in its own container
Thanks in advance,
from tsed.
So you need to have three express server instance (that instantiate his own controllers), one per container, and one express server that list all services generated by each instances. The fourth server will be a proxy, I think.
Actually, TsExpressDecorators, manage one express server by node process. So you must to start micro service in a separately node process (container).
The fourth server can get all routes via an http request on /rest
endpoint for each server started.
I'm not if I answered to your question, and if my solution is the right solution ^^.
See you
from tsed.
While your solution is correct, it can cause problems. I can see two mains sources of problems with this implementation :
- If one of my micro Service dies, the lister server will not be able to get its endpoints, resulting in a truncated list of endpoints
- If the lister server dies, all my micro-Services are incapacitated
We discussed it internally and we are going to develop a external parsing solution to get routes and controller methods directly from .ts controller files.
Thank you for your time and keep up the good work
from tsed.
Thanks @Tlahey ^^
You can use node forever to prevent this problem :) Node application will be restarted automaticaly ;)
from tsed.
Related Issues (20)
- [BUG] ResponseFilter does not serialize HOT 4
- Link Checker Report HOT 1
- Link Checker Report HOT 1
- [BUG] Missing `requestFields` in `DILoggerOptions` HOT 2
- The automated release is failing 🚨 HOT 1
- [BUG] TypeError: fs.readFile is not a function HOT 7
- BullMQ - Flow HOT 2
- Link Checker Report
- [BUG] UseCache does not work on services HOT 4
- [BUG] Named export 'Appender' not found. HOT 5
- Add support for MikroORM v6 HOT 2
- using `@Examples()` on a model HOT 3
- Support `@Hidden` in query parameters HOT 9
- [TECH] Migrate tests from jest to vitest HOT 2
- [TECH] Use vite to bundle front package
- [BUG] Dependencies issue when update Mikro orm to v4.5.0 + HOT 2
- [BUG] Update temporal.io dependencies causing issue HOT 1
- [BUG] Dependency injection w/ useAsyncFactory returns Promise on 2nd invoke() HOT 3
- Link Checker Report HOT 1
- [BUG] Missing repository's d.ts after running 'npm run prisma:generate'
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tsed.