A simple non-official javascript library for reading glucose data from the Dexcom Share API.
dexcom can be used client-side (in-browser) by adding the script to your html:
$ curl -sL https://raw.githubusercontent.com/coderkearns/dexcom/master/index.js > dexcom.js
<script src="dexcom.js"></script>
dexcom can also be used in node.js, but requires fetch. It can currently be used in Node.js v17.6.x and above.
$ curl -sL https://raw.githubusercontent.com/coderkearns/dexcom/master/index.js > dexcom.js
$ node --version
v17.6.0
$ node --experimental-fetch <file>.js
// <file>.js
const Client = require('./dexcom.js');
This step only needs to be done once per account.
Download the Dexcom G6 / G5 / G4 app, then enable the Share service.
const dexcomClient = new Client()
await dexcomClient.login("myUsername", "myPasswordIsCool1*")
const lastReading = await dexcomClient.fetchLastReading()
console.log(`Reading value is ${lastReading.trend.arrow}${lastReading.mgdl}. The value is ${lastReading.trend.desc}. The value was measured at ${lastReading.time}.`)
const last20ReadingsInTheLast1Hour = await dexcomClient.fetchReadings(60, 20)
This project is licensed under the MIT License - see the LICENSE file for details.