Python – An instance of Google App Engine running using a front-end in nodejs and a back-end server in python

An instance of Google App Engine running using a front-end in nodejs and a back-end server in python… here is a solution to the problem.

An instance of Google App Engine running using a front-end in nodejs and a back-end server in python

I’m getting into GCP and GAE, but also nodejs and python and networking (I know).

[+] What do I have:

Basically I have some nodejs code that takes some input and then should send that input to some python code that will do more with it. My first idea was to deploy NodeJS code via GAE, then host the Python code in a Python server and then make a POST request from the NodeJS frontend to the Python server backend.

[+] What I would like to be able to do:

Just deploy my Nodejs code and

my python code in the same project and GAE instance so that Nodejs is the front end that people see, but the Python server also runs in the same environment and can only be used with Nodejs without sending anything online.

[+] What I’ve read

https://www.netguru.co/blog/use-node-js-backend

Google App Engine – Front and Backend Web Development

And countless other Google searches for this type of setting but to no avail.
I would appreciate it if someone could point me in the right direction.

Solution

You can’t have python and nodejs running in the same instance, but they can run as separate services, each with its own instance in the same GAE application/project. See also Service isolation Maybe < a href="https://stackoverflow.com/questions/41681288/deploying-different-languages-services-to-the-same-application-google-app-engin" rel="noreferrer noopener." nofollow">Deploying different languages services to the same Application [Google App Engine]

Using a post request can work well, but it may take some effort to ensure that there is no external access.

Since you intend to use the nodejs service as a frontend, you can only use flexible environment for this, It limits the interservice communication options – you can’t use push queues (only properly supported in standard environment) IMHO this would be a better/safer solution than posting requests.

Another secure communication option is to have the nodejs service put data into a data store and have the python service fetch data from there – the data store is shared by all instances/versions/services within the same GAE application. IMHO, the coupling is also looser – each service can run (at least for a while), while the other does not exist (which is not possible with a post request).

You may be interested How to tell if a Google App Engine documentation page applies to the standard or the flexible environment

Update:

Node.JS is currently also available in standard environments, so you can use these features, see

Related Problems and Solutions