This commit is contained in:
Adrien Marquès 2018-07-07 23:09:19 +02:00
parent b488f8969e
commit ee82f48ada
3 changed files with 15 additions and 3 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
*.so *.so
.build

View File

@ -7,14 +7,14 @@ import (
func main() { func main() {
srv, err := aicra.Init("manifest.json") server, err := aicra.New("manifest.json")
if err != nil { if err != nil {
log.Fatal("cannot load config", err) log.Fatal("cannot load config", err)
} }
log.Printf("[Server up] 0.0.0.0:4242\n") log.Printf("[Server up] 0.0.0.0:4242\n")
err = srv.Launch(4242) err = server.Listen(4242)
if err != nil { if err != nil {
log.Fatalf("*** server failed (%s)\n", err) log.Fatalf("*** server failed (%s)\n", err)
} }

11
middleware/1-auth/main.go Normal file
View File

@ -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");
}