Category: Database, Data, firewall

by You will learn: And we’ll do it all with Go.

Next, we need to do three things for the temperature sensor: So in our main func, we’ll initialize it: Then we’ll create our new DHT reader: Notice I’m using the GPIO we set in the const above, and calling NewDHT and setting the parameter to Fahrenheit.

Then we store the data from the JSON in our database by passing it to the saveToDatabase function we just created.

Our API is so simple we could write it out by hand, but by using Gin we can expand it and make it more robust later.

Related Articles