I am in a serious problem with my code. I am developing a bot for Telegram using Node.JS and ExpressJS. To make requests I use ngrok and to store information PostgreSQL. My problem is: when running the program with only one user connected and talking to the bot and processing operations, the code runs very well. But, when multiple users are connected at the same time, the program mixes the code for all users. Example:
If the first user activates a boolean variable for specific selection or if the bot is processing an SQL query for this user and showing the result, the second and third user are affected ... Why?
I think that maybe PostgreSQL doesn't allow multiple transactions with the database running in the local machine or maybe its a problem with the code.
How can I solve this?