Code refactoring for streams HandleFunc

This commit is contained in:
Alex X
2024-06-14 12:52:55 +03:00
parent 1ac9d54dab
commit ecfe802065
15 changed files with 53 additions and 93 deletions
+3 -9
View File
@@ -10,19 +10,13 @@ import (
)
func Init() {
streams.HandleFunc("nest", streamNest)
streams.HandleFunc("nest", func(source string) (core.Producer, error) {
return nest.Dial(source)
})
api.HandleFunc("api/nest", apiNest)
}
func streamNest(url string) (core.Producer, error) {
client, err := nest.NewClient(url)
if err != nil {
return nil, err
}
return client, nil
}
func apiNest(w http.ResponseWriter, r *http.Request) {
query := r.URL.Query()
cliendID := query.Get("client_id")