Skip to content

Commit ae730ac

Browse files
committed
update with new router logic
1 parent 0fefe96 commit ae730ac

4 files changed

Lines changed: 28 additions & 30 deletions

File tree

Gopkg.lock

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,20 @@
2626

2727

2828
[[constraint]]
29+
branch = "master"
2930
name = "github.com/akerl/go-lambda"
30-
version = "0.2.0"
3131

3232
[[constraint]]
3333
name = "github.com/aymerick/raymond"
3434
version = "2.0.2"
3535

3636
[[constraint]]
3737
name = "github.com/google/go-github"
38-
version = "15.0.0"
38+
version = "18.2.0"
3939

4040
[[constraint]]
4141
name = "github.com/google/uuid"
42-
version = "0.2.0"
42+
version = "1.0.0"
4343

4444
[[constraint]]
4545
name = "github.com/gorilla/securecookie"

main.go

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55

66
"github.com/akerl/github-auth-lambda/session"
77

8-
"github.com/akerl/go-lambda/apigw/router"
8+
"github.com/akerl/go-lambda/mux"
99
"golang.org/x/oauth2"
1010
"golang.org/x/oauth2/github"
1111
)
@@ -47,15 +47,13 @@ func main() {
4747
Scopes: scopes,
4848
}
4949

50-
r := router.Router{
51-
Routes: []router.Route{
52-
{Path: authRegex, Handler: authHandler},
53-
{Path: logoutRegex, Handler: logoutHandler},
54-
{Path: callbackRegex, Handler: callbackHandler},
55-
{Path: indexRegex, Handler: indexHandler},
56-
{Path: faviconRegex, Handler: faviconHandler},
57-
{Path: defaultRegex, Handler: defaultHandler},
58-
},
59-
}
60-
r.Start()
50+
d := mux.NewDispatcher(
51+
mux.NewRoute(authRegex, authHandler),
52+
mux.NewRoute(logoutRegex, logoutHandler),
53+
mux.NewRoute(callbackRegex, callbackHandler),
54+
mux.NewRoute(indexRegex, indexHandler),
55+
mux.NewRoute(faviconRegex, faviconHandler),
56+
mux.NewRoute(defaultRegex, defaultHandler),
57+
)
58+
mux.Start(d)
6159
}

router.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ func callbackHandler(req events.Request) (events.Response, error) {
156156
}
157157
sess.Login = *user.Login
158158

159-
teams, _, err := client.Organizations.ListUserTeams(context.Background(), &github.ListOptions{})
159+
teams, _, err := client.Teams.ListUserTeams(context.Background(), &github.ListOptions{})
160160
if err != nil {
161161
return fail(fmt.Sprintf("error getting teams: %s", err))
162162
}

0 commit comments

Comments
 (0)