22 lines
579 B
Go
22 lines
579 B
Go
//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"
|
|
|
|
"gitea.rebus.ninja/lore/go-nats-client/gen/wasmcloud/messaging/handler"
|
|
)
|
|
|
|
func init() {
|
|
handler.Exports.HandleMessage = handleMessage
|
|
}
|
|
|
|
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() {}
|