1
0

A dummy Song handler was added.

This commit is contained in:
Alexander Andreev 2023-10-01 03:35:33 +04:00
parent 18bd1fb12d
commit 07d11ce3ff
Signed by: Arav
GPG Key ID: D22A817D95815393
2 changed files with 14 additions and 1 deletions

View File

@ -54,7 +54,7 @@ func main() {
s.Handler(http.MethodGet, "/", djh.PlaylistNext)
s = r.Sub("/song")
s.Handler(http.MethodGet, "/", http.NotFound)
s.Handler(http.MethodGet, "/", djh.Song)
srv := ihttp.NewHttpServer(r)

View File

@ -2,6 +2,7 @@ package http
import (
"dwelling-radio/internal/radio"
"encoding/json"
"fmt"
"log"
"net/http"
@ -47,3 +48,15 @@ func (dj *DJHandlers) PlaylistNext(w http.ResponseWriter, _ *http.Request) {
}
fmt.Fprint(w, nxt)
}
func (dj *DJHandlers) Song(w http.ResponseWriter, r *http.Request) {
isList := r.URL.Query().Has("list")
w.Header().Add("Content-Type", "application/json")
if isList {
// TODO
json.NewEncoder(w).Encode("")
} else {
// TODO
json.NewEncoder(w).Encode("")
}
}