Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
komuw committed Jun 18, 2024
1 parent c859b92 commit cc83514
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ func main() {
const secretKey = "super-h@rd-Pas1word"

api := NewApp(myDB{map[string]string{}}, l)

basicAuth, err := middleware.BasicAuth(api.handleFileServer(), "user", "some-long-1passwd")
if err != nil {
panic(err)
}

mx := mux.New(
config.WithOpts("localhost", 65081, secretKey, config.DirectIpStrategy, l),
nil,
Expand All @@ -27,7 +33,7 @@ func main() {
mux.NewRoute(
"staticAssets/:file",
mux.MethodAll,
middleware.BasicAuth(api.handleFileServer(), "user", "some-long-1passwd"),
basicAuth,
),
mux.NewRoute(
"check/:age/",
Expand All @@ -46,8 +52,7 @@ func main() {
),
)

err := server.Run(mx, config.DevOpts(l, secretKey))
if err != nil {
if err := server.Run(mx, config.DevOpts(l, secretKey)); err != nil {

Check failure on line 55 in example/main.go

View workflow job for this annotation

GitHub Actions / run_analysis (>=1.22.4, ubuntu-22.04)

declaration of "err" shadows declaration at line 20
l.Error("server.Run error", "error", err)
os.Exit(1)
}
Expand Down

0 comments on commit cc83514

Please sign in to comment.