Files
ippserver/main.go
2020-10-28 16:56:38 +01:00

37 lines
744 B
Go

package main
import (
"context"
"ippserver/packages/mdnsserver"
"net/http"
log "github.com/sirupsen/logrus"
)
func main() {
ctx, cancel := context.WithCancel(context.Background())
defer cancel() // cancel when we are finished consuming integers
go mdnsserver.Run(ctx)
http.HandleFunc("/ipp/print", handle)
log.Info("http server started on :1234")
err := http.ListenAndServe(":1234", nil)
if err != nil {
log.Fatal("ListenAndServe: " + err.Error())
}
}
func handle(w http.ResponseWriter, r *http.Request) {
log.Infoln("handle")
if r.Method != "POST" {
http.Error(w, "Unsupported method", http.StatusMethodNotAllowed)
}
// Disable caching of this page
// Check if user is logged in, if not redirect to login page
}