Skip to content

Commit

Permalink
docs: fix README
Browse files Browse the repository at this point in the history
  • Loading branch information
tigerwill90 committed Jan 24, 2025
1 parent 1090ac3 commit fdb4379
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,27 @@ go get -u github.com/tigerwill90/otelfox
package main

import (
"errors"
"github.com/tigerwill90/fox"
"github.com/tigerwill90/otelfox"
"log"
"net/http"
)

func main() {
r := fox.New(
f, err := fox.New(
fox.WithMiddleware(otelfox.Middleware("fox")),
)
if err != nil {
panic(err)
}

r.MustHandle(http.MethodGet, "/hello/{name}", func(c fox.Context) {
f.MustHandle(http.MethodGet, "/hello/{name}", func(c fox.Context) {
_ = c.String(http.StatusOK, "hello %s\n", c.Param("name"))
})

log.Fatalln(http.ListenAndServe(":8080", r))
if err = http.ListenAndServe(":8080", f); err != nil && !errors.Is(err, http.ErrServerClosed) {
log.Fatalln(err)
}
}
````

0 comments on commit fdb4379

Please sign in to comment.