Add initial Go server skeleton with HTTP handlers, middleware, job runner, and stubs

This commit is contained in:
Dev
2025-12-13 15:18:04 +00:00
commit 61570cae23
28 changed files with 921 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
package http
import (
"database/sql"
"net/http"
"net/http/httptest"
"testing"
"github.com/example/storage-appliance/internal/service/mock"
)
func TestPoolsHandler(t *testing.T) {
m := &mock.MockZFSService{}
app := &App{DB: &sql.DB{}, ZFSSvc: m}
req := httptest.NewRequest(http.MethodGet, "/api/pools", nil)
w := httptest.NewRecorder()
app.PoolsHandler(w, req)
if w.Code != http.StatusOK {
t.Fatalf("expected 200, got %d", w.Code)
}
body := w.Body.String()
if body == "" {
t.Fatalf("expected non-empty body")
}
}