Merge all the server components

This commit is contained in:
Tom Wiesing 2022-09-15 15:04:35 +02:00
parent 85b5603d9d
commit f5f2ac1a03
No known key found for this signature in database
25 changed files with 365 additions and 352 deletions

View file

@ -0,0 +1,26 @@
package dis
import (
"net/http"
"github.com/tkw1536/goprogram/stream"
)
func (dis Dis) info(io stream.IOStream) (http.Handler, error) {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
all, err := dis.Instances.All()
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
w.Write([]byte("internal server error"))
io.EPrintln(err)
return
}
for _, wk := range all {
w.WriteHeader(http.StatusOK)
w.Write([]byte(wk.Slug))
w.Write([]byte("\n"))
}
}), nil
}