doc.go 622 B

123456789101112131415161718192021222324252627282930313233343536
  1. // server for the 'complete' page
  2. package main
  3. import (
  4. stdlog "log"
  5. "net"
  6. "net/http"
  7. "os"
  8. "github.com/cryptix/go/logging"
  9. "github.com/cryptix/exp/multiModulePage/complete"
  10. )
  11. func main() {
  12. logging.SetupLogging(nil)
  13. var mylog = logging.Logger("websrv")
  14. stdlog.Printf("Hello wold")
  15. mylog.Log("hello", "mylog")
  16. h, err := complete.Handler(nil)
  17. logging.CheckFatal(err)
  18. addr := os.Args[1]
  19. if addr == "" {
  20. addr = "[::]:0"
  21. }
  22. lis, err := net.Listen("tcp", addr)
  23. logging.CheckFatal(err)
  24. mylog.Log("msg", "http listening", "addr", lis.Addr().String())
  25. err = http.Serve(lis, h)
  26. logging.CheckFatal(err)
  27. }