docs: Update README and code comments

This commit is contained in:
Bendodroid 2024-08-03 21:02:44 +02:00
commit 5dacfd0dfe
2 changed files with 33 additions and 22 deletions

View file

@ -50,20 +50,22 @@ func main() {
os.Exit(0)
}(&conf.Response)
// Register HTTP handlers
// Root handler
http.HandleFunc("GET /{$}",
handlers.Root(&conf.Response),
)
// state->open
http.HandleFunc("PUT /state/open",
handlers.StateOpen(conf.Credentials, conf.Dynamic.State.Open.AllowedCredentials, &conf.Response.State),
)
// state->message
http.HandleFunc("PUT /state/message",
handlers.StateMessagePUT(conf.Credentials, conf.Dynamic.State.Open.AllowedCredentials, &conf.Response.State),
)
http.HandleFunc("DELETE /state/message",
handlers.StateMessageDELETE(conf.Credentials, conf.Dynamic.State.Open.AllowedCredentials, &conf.Response.State),
)
// Register handler for environmental sensors
// Register handlers for environmental sensors
for sensorType, envSensorConfigs := range conf.Dynamic.Sensors {
for i, envSensorConfig := range envSensorConfigs {
urlPattern := "PUT " + util.GetSensorURLPath(