manulera / ShareYourCloning

A web application to generate molecular cloning strategies in json format, and share them with others.
MIT License
18 stars 3 forks source link

Work with single port? #7

Closed manulera closed 3 months ago

manulera commented 8 months ago

@NicolasCARPi said

It's a pity that the backend also has to be externally accessible, but I guess that's the drawback of a separate frontend in modern JS. That means that two ports must be opened for a single service. Not a big deal, but I wonder if somehow the "backend requests" could instead go to the frontend, but on a special route that is forwarded to backend internally. This would allow to not expose the backend to the world, and only frontend container could be allowed to talk to backend, which is a big win in attack surface reduction. Did you look into this?

Regarding this, I suppose you could serve the index.html + built javascript from a backend endpoint, but I have to look more into how the routing should be handled.

I am still not using this functionality (there is only the root url in the frontend), but typically react can take over certain routes for conditionally rendering different pages. For instance, if there was a /dashboard, react would render the page without making a request to the server. I suppose you can have both types of routes at the same time. Something to look into.

_Originally posted by @manulera in https://github.com/manulera/ShareYourCloning_backend/issues/108#issuecomment-2000061252_