diff options
| author | Jeff Carr <[email protected]> | 2025-09-09 17:05:05 -0500 | 
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-09-09 17:05:05 -0500 | 
| commit | c0f0414ff8a058f7d3d2d10af9a2ae2b8e3a46a2 (patch) | |
| tree | e80432fffebab218c1cb3394450f668ea400a995 | |
| parent | 47cd147ca0f8558d9145867ab37498f3b43fd753 (diff) | |
smarter variable name. predicts a logpb
| -rw-r--r-- | httpRequest.proto | 2 | ||||
| -rw-r--r-- | startHTTP.go | 25 | 
2 files changed, 26 insertions, 1 deletions
diff --git a/httpRequest.proto b/httpRequest.proto index 8b1c86b..f165c9b 100644 --- a/httpRequest.proto +++ b/httpRequest.proto @@ -24,7 +24,7 @@ message HttpRequest {                                       // HttpRequest repre          int64                       clientDataLen     = 12; // len(body)          bytes                       serverData        = 13; // the server response          int64                       serverDataLen     = 14; // len(data) -        repeated string             log               = 15; // use this to store whatever you want while the whole POST happens +        repeated string             logs              = 15; // use this to store whatever you want while the whole POST happens  }  message HttpRequests {                                      // `autogenpb:marshal` `autogenpb:mutex` diff --git a/startHTTP.go b/startHTTP.go new file mode 100644 index 0000000..38c0311 --- /dev/null +++ b/startHTTP.go @@ -0,0 +1,25 @@ +// Copyright 1994-2025 WIT.COM Inc Licensed GPL 3.0 + +package httppb + +import ( +	"fmt" +	"net/http" + +	"go.wit.com/log" +) + +// starts and sits waiting for HTTP requests +func StartHTTP(okHandler func(http.ResponseWriter, *http.Request), port int) error { +	http.HandleFunc("/", okHandler) + +	p := fmt.Sprintf(":%d", port) +	log.Println("Running on port", p) + +	err := http.ListenAndServe(p, nil) +	if err != nil { +		log.Println("Error starting server:", err) +		return err +	} +	return nil +}  | 
