added in a playground
This commit is contained in:
8
playground/Makefile
Normal file
8
playground/Makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
run-chi:
|
||||
go run ./chi
|
||||
run-mux:
|
||||
go run ./mux
|
||||
|
||||
bench-using-wrk:
|
||||
wrk -t12 -c400 -d10s http://localhost:3001/
|
||||
15
playground/chi/main.go
Normal file
15
playground/chi/main.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-chi/chi/v5"
|
||||
)
|
||||
|
||||
func main() {
|
||||
r := chi.NewRouter()
|
||||
r.Get("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Write([]byte("welcome"))
|
||||
})
|
||||
http.ListenAndServe(":3001", r)
|
||||
}
|
||||
8
playground/go.mod
Normal file
8
playground/go.mod
Normal file
@@ -0,0 +1,8 @@
|
||||
module code.patial.tech/go/mux/playground
|
||||
|
||||
go 1.24
|
||||
|
||||
require (
|
||||
code.patial.tech/go/mux v0.7.1
|
||||
github.com/go-chi/chi/v5 v5.2.3
|
||||
)
|
||||
4
playground/go.sum
Normal file
4
playground/go.sum
Normal file
@@ -0,0 +1,4 @@
|
||||
code.patial.tech/go/mux v0.7.1 h1:XJJbG+x06Y14DXQqgDonLarbmdxOhxj21IFD91IPF6Q=
|
||||
code.patial.tech/go/mux v0.7.1/go.mod h1:Wqto23z9tqJwxB/byiDeEi2NLqauHaOf+HjUkmgp2MM=
|
||||
github.com/go-chi/chi/v5 v5.2.3 h1:WQIt9uxdsAbgIYgid+BpYc+liqQZGMHRaUwp0JUcvdE=
|
||||
github.com/go-chi/chi/v5 v5.2.3/go.mod h1:L2yAIGWB3H+phAw1NxKwWM+7eUH/lU8pOMm5hHcoops=
|
||||
15
playground/mux/main.go
Normal file
15
playground/mux/main.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"code.patial.tech/go/mux"
|
||||
)
|
||||
|
||||
func main() {
|
||||
r := mux.New()
|
||||
r.GET("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Write([]byte("welcome"))
|
||||
})
|
||||
http.ListenAndServe(":3001", r)
|
||||
}
|
||||
Reference in New Issue
Block a user