smarter variable name. predicts a logpb
This commit is contained in:
parent
47cd147ca0
commit
c0f0414ff8
|
@ -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`
|
||||
|
|
|
@ -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
|
||||
}
|
Loading…
Reference in New Issue