2024-12-05 23:30:02 +00:00
|
|
|
//go:generate go run github.com/bytecodealliance/wasm-tools-go/cmd/wit-bindgen-go generate --world hello --out gen ./wit
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"net/http"
|
|
|
|
|
2024-12-05 23:36:10 +00:00
|
|
|
"gitea.rebus.ninja/lore/go-nats-client/gen/wasmcloud/messaging/handler"
|
2024-12-05 23:30:02 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
2024-12-05 23:36:10 +00:00
|
|
|
handler.Exports.HandleMessage = handleMessage
|
2024-12-05 23:30:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func handleRequest(w http.ResponseWriter, r *http.Request) {
|
|
|
|
fmt.Fprintf(w, "Hello from Go!\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() {}
|