mirror of
https://github.com/praetorian-inc/wasmforge
synced 2026-06-22 22:52:31 +00:00
30 lines
655 B
Go
30 lines
655 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
"os"
|
|
)
|
|
|
|
func main() {
|
|
addr := ":8080"
|
|
if len(os.Args) > 1 {
|
|
addr = os.Args[1]
|
|
}
|
|
|
|
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
|
|
fmt.Fprintf(w, "Hello from WasmForge! Request: %s %s\n", r.Method, r.URL.Path)
|
|
})
|
|
|
|
http.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) {
|
|
w.Header().Set("Content-Type", "application/json")
|
|
fmt.Fprintf(w, `{"status":"ok","runtime":"wasmforge"}`)
|
|
})
|
|
|
|
fmt.Printf("WasmForge HTTP server listening on %s\n", addr)
|
|
if err := http.ListenAndServe(addr, nil); err != nil {
|
|
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
|
|
os.Exit(1)
|
|
}
|
|
}
|