added (work-in-progess) HTTP server

master
Charles Iliya Krempeaux 2022-06-29 06:40:10 -07:00
rodzic a0c059fa91
commit ebb3ce510d
2 zmienionych plików z 17 dodań i 0 usunięć

Wyświetl plik

@ -0,0 +1,3 @@
package cfg
const HTTPPort = 8080

Wyświetl plik

@ -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
}
}
}