Files
uopi/debug_api.go
T
2026-05-21 07:41:56 +02:00

33 lines
708 B
Go

package main
import (
"context"
"fmt"
"log/slog"
"net/http"
"net/http/httptest"
"os"
"github.com/uopi/uopi/internal/api"
"github.com/uopi/uopi/internal/broker"
"github.com/uopi/uopi/internal/storage"
)
func main() {
log := slog.New(slog.NewTextHandler(os.Stderr, nil))
store, _ := storage.New("./interfaces")
// broker.New(ctx, log, maxRate)
brk := broker.New(context.Background(), log, 0)
h := api.New(brk, nil, store, "", "", log)
mux := http.NewServeMux()
h.Register(mux, "/api/v1")
req := httptest.NewRequest("GET", "/api/v1/interfaces", nil)
rr := httptest.NewRecorder()
mux.ServeHTTP(rr, req)
fmt.Printf("Status: %d\n", rr.Code)
fmt.Printf("Body: %s\n", rr.Body.String())
}