I am measuring battery voltage using a Raspberry Pi GPIO and displaying it on a local web app. Currently, my process is to save the voltage reading and the timestamp as a JSON file on the disk and then read the JSON file using the Javascript fetch API from the local web app (the JSON file is saved on the local web app directory).
I was wondering if there was a more efficient / better way of achieving this.
I am using python 3 to read the battery voltage and generate the JSON file.
The local web app runs on a Node + Express server.
If you want the data to be persistent, saving it to the disk is the way to go.
You might want to consider storing the data in a database, and using the database API to retrieve the data instead of reading a JSON file, though.
Efficient way to show sensor data on local web app