Add Chi
This commit is contained in:
parent
3445466197
commit
334c007c0e
3 changed files with 24 additions and 0 deletions
20
main.go
Normal file
20
main.go
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
"github.com/go-chi/chi/v5"
|
||||
"github.com/go-chi/chi/v5/middleware"
|
||||
)
|
||||
|
||||
func main() {
|
||||
r := chi.NewRouter()
|
||||
r.Use(middleware.Logger)
|
||||
r.Get("/", func(w http.ResponseWriter, _ *http.Request) {
|
||||
w.Write([]byte("welcome"))
|
||||
})
|
||||
|
||||
log.Println("listening on http://localhost:8000/")
|
||||
http.ListenAndServe("127.0.0.1:8000", r)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue