feat: init update

This commit is contained in:
2026-01-02 17:04:48 +08:00
commit a92b4daaf4
5 changed files with 41 additions and 0 deletions

9
hello/hello.go Normal file
View File

@@ -0,0 +1,9 @@
package hello
import (
"net/http"
)
func HelloHandler(w http.ResponseWriter, r *http.Request) {
w.Write([]byte("Hello, World!"))
}

16
hello/hello_test.go Normal file
View File

@@ -0,0 +1,16 @@
package hello
import (
"testing"
"net/http/httptest"
)
func TestHelloHandler(t *testing.T) {
w := httptest.NewRecorder()
req := httptest.NewRequest("GET", "/hello", nil)
HelloHandler(w, req)
expected := "Hello, World!"
if w.Body.String() != expected {
t.Errorf("Expected %q but got %q", expected, w.Body.String())
}
}