GithubHelp home page GithubHelp logo

Comments (5)

Romakita avatar Romakita commented on May 10, 2024

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.

Tlahey avatar Tlahey commented on May 10, 2024

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.

Romakita avatar Romakita commented on May 10, 2024

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 /restendpoint 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.

Tlahey avatar Tlahey commented on May 10, 2024

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.

Romakita avatar Romakita commented on May 10, 2024

Thanks @Tlahey ^^

You can use node forever to prevent this problem :) Node application will be restarted automaticaly ;)

from tsed.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.