A
A
Alexey Nevzorov2019-01-07 20:38:00
Node.js
Alexey Nevzorov, 2019-01-07 20:38:00

How to interact Frontend (NodeJS, ReactJS/Angular) with Backend (Python, Flask) under SSR without persistent authentication?

When designing SSR, there was a problem of interaction between the frontend and the backend. Each time you have to authenticate, and then also log in to receive the next portion of data, i.e. each request is another launch of the backend. Communication via sockets (rest and graphql).
How to avoid constantly initializing the backend with each request of the frontend located on the same piece of hardware?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Filippenko, 2019-01-13
@alexfilus

https://habr.com/company/badoo/blog/434272/
read how they used RoadRunner.
The idea is to have some kind of proxy that will check the authorization, and if everything is ok, then pass the request further to the application. If there are not many users, and there is enough RAM, then you can keep the data necessary to check the jwt token and the availability of rights permanently in memory. It will work super-fast, and extra requests will not reach Flask.
And if so, then you can think about caching the response. It depends on what you give for the data.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question