nginx-golang: add dev envs support (#273)
* Add Docker Desktop Developer Environments config * Upgrade from Go 1.13 (🙀) to 1.18 * Rename `frontend` -> `proxy` for clarity & consistency with other samples * Add Chi as a dependency to provide an example of Go module dependencies for parity with other samples Signed-off-by: Milas Bowman <milas.bowman@docker.com>
This commit is contained in:
@@ -4,11 +4,14 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
"github.com/go-chi/chi/v5"
|
||||
"github.com/go-chi/chi/v5/middleware"
|
||||
)
|
||||
|
||||
func handler(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Println(r.URL.RawQuery)
|
||||
fmt.Fprintf(w, `
|
||||
fmt.Fprintf(
|
||||
w, `
|
||||
## .
|
||||
## ## ## ==
|
||||
## ## ## ## ## ===
|
||||
@@ -21,10 +24,15 @@ func handler(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
Hello from Docker!
|
||||
|
||||
`)
|
||||
`,
|
||||
)
|
||||
}
|
||||
|
||||
func main() {
|
||||
http.HandleFunc("/", handler)
|
||||
log.Fatal(http.ListenAndServe(":80", nil))
|
||||
r := chi.NewRouter()
|
||||
r.Use(middleware.Logger)
|
||||
r.Get("/", handler)
|
||||
|
||||
fmt.Println("Go backend started!")
|
||||
log.Fatal(http.ListenAndServe(":80", r))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user