From ebb3ce510dbdc94f92b515aa61e27877d71365ca Mon Sep 17 00:00:00 2001 From: Charles Iliya Krempeaux Date: Wed, 29 Jun 2022 06:40:10 -0700 Subject: [PATCH] added (work-in-progess) HTTP server --- greataped/cfg/http.go | 3 +++ greataped/main.go | 14 ++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 greataped/cfg/http.go diff --git a/greataped/cfg/http.go b/greataped/cfg/http.go new file mode 100644 index 0000000..b091172 --- /dev/null +++ b/greataped/cfg/http.go @@ -0,0 +1,3 @@ +package cfg + +const HTTPPort = 8080 diff --git a/greataped/main.go b/greataped/main.go index d3b793a..5782f31 100644 --- a/greataped/main.go +++ b/greataped/main.go @@ -2,10 +2,24 @@ package main import ( _ "github.com/reiver/greatape/greataped/arg" + "github.com/reiver/greatape/greataped/cfg" "fmt" + "net/http" + "os" ) func main() { fmt.Println("greateape daemon 🐒") + + { + var addr string = fmt.Sprintf(":%d", cfg.HTTPPort) + + err := http.ListenAndServe(addr, nil) + if nil != err { + fmt.Fprintf(os.Stderr, "ERROR: problem with HTTP server: %s\n", err) + os.Exit(1) + return + } + } }