Wworking on improving the tool
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
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())
|
||||
}
|
||||
Reference in New Issue
Block a user