...

Source file src/github.com/go-chi/chi/_examples/hello-world/main.go

Documentation: github.com/go-chi/chi/_examples/hello-world

     1  package main
     2  
     3  import (
     4  	"net/http"
     5  
     6  	"github.com/go-chi/chi"
     7  	"github.com/go-chi/chi/middleware"
     8  )
     9  
    10  func main() {
    11  	r := chi.NewRouter()
    12  	r.Use(middleware.RequestID)
    13  	r.Use(middleware.Logger)
    14  	r.Use(middleware.Recoverer)
    15  
    16  	r.Get("/", func(w http.ResponseWriter, r *http.Request) {
    17  		w.Write([]byte("hello world"))
    18  	})
    19  
    20  	http.ListenAndServe(":3333", r)
    21  }
    22  

View as plain text