I am looking for a solution that allows me to create different node
apps for each of the major concerns that a server project should deal with (aka. frontend
and backend
).
Each of the apps should only handle requests coming on paths designated to it, completely ignoring requests on the other paths. Ideally, requests coming on paths not designated for an app, should never reach that app at all. More exactly:
- a dedicated
backend
only app handling all requests coming tohttps://<some-domain.abc>/api
.
This is the only path that should bother this app. - a
frontend
only app handling all other paths, except the/api
one
The frontend and backend apps could either run on the same physical server, or they could run on completely different physical servers. They should be completely independent, unaware of each other, except for the API interface.
It is possible that later on some other apps will be added to handle requests coming on other paths, but none is planned right now (maybe /graphiql
for debugging graphql).
I know this question has come up multiple times in the past, but the answers I have found always reference some http ready-made server package (express
comes up in 99% of cases). I do not want to use such packages, I am using the bare node http
/https
/http/2
packages and building up the stack on my own.
CodePudding user response:
A reverse proxy (Nginx/Apache) would help you accomplish this.
CodePudding user response:
I did a similar deployment process 15 months ago.
https://gist.github.com/umutyerebakmaz/465b0f177dbb88c8c99fd0438b0d7151