I’m making a web-app with the MEAN stack ( mongodb, express, angular, node) that will be hosted on a Raspberry Pi. I have connected flow sensors to a kegerator (keg fridge) that will send data to MongoDB to record who drinks, and how much. (lol this way my housemates and I can drink out of a keg and know exactly who owes what).
So far I have user authentication and authorization set up, and im also able to get data from the sensors and log it into the database.
My problem: I need to connect the sensor data to the user that’s currently logged in. The idea is that users will log in, pour beer, and the data will be sent to their “account”
What I want to do is write a script in the express app that waits for a user to log in, then starts recording sensor data. However I don’t know how to do this!!!
I think my problem is that I don’t fully understand how routing and middleware all work together