diff --git a/.gitignore b/.gitignore index f1fe8d1..d7a1847 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -*.so \ No newline at end of file +*.so +.build \ No newline at end of file diff --git a/cmd/test/main.go b/cmd/test/main.go index 88c8b50..7677cb2 100644 --- a/cmd/test/main.go +++ b/cmd/test/main.go @@ -7,14 +7,14 @@ import ( func main() { - srv, err := aicra.Init("manifest.json") + server, err := aicra.New("manifest.json") if err != nil { log.Fatal("cannot load config", err) } log.Printf("[Server up] 0.0.0.0:4242\n") - err = srv.Launch(4242) + err = server.Listen(4242) if err != nil { log.Fatalf("*** server failed (%s)\n", err) } diff --git a/middleware/1-auth/main.go b/middleware/1-auth/main.go new file mode 100644 index 0000000..a177db9 --- /dev/null +++ b/middleware/1-auth/main.go @@ -0,0 +1,11 @@ +package main + +import ( + "git.xdrm.io/go/aicra/middleware" + "net/http" +) + +// Authentication middleware +func Inspect(req http.Request, scope middleware.Scope){ + scope = append(scope, "user"); +}