//go:generate go run github.com/bytecodealliance/wasm-tools-go/cmd/wit-bindgen-go generate --world hello --out gen ./wit package main import ( "net/http" "fmt" "go.wasmcloud.dev/component/net/wasihttp" "gitea.rebus.ninja/lore/wasm-nats-producer-client/gen/wasmcloud/messaging/handler" ) func init() { wasihttp.HandleFunc(handleRequest) handler.Exports.HandleMessage = handleMessage } func handleRequest(w http.ResponseWriter, r *http.Request) { // get body as string handleHttp(r.FormValue("data")) // send response fmt.Fprintf(w, "Message sent!\n") } // Since we don't run this program like a CLI, the `main` function is empty. Instead, // we call the `handleRequest` function when an HTTP request is received. func main() {}