Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
mredencom committed Aug 25, 2021
1 parent 9a0961a commit dff7436
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,24 @@ func main() {
package main

import (
"github.com/php2go/netpollmux/mux"
"bufio"
"log"
"net"
"net/http"
"sync"

"github.com/julienschmidt/httprouter"
"github.com/php2go/netpollmux/internal/logger"
"github.com/php2go/netpollmux/mux"
"github.com/php2go/netpollmux/netpoll"
)

func main() {
m := mux.NewRouter()
r := mux.NewRender()
r.GzipAll().DeflateAll().Charset("utf-8")
m.HandleFunc("/hello/:id", func(w http.ResponseWriter, req *http.Request) {
r.JSON(w, req, []string{"compress"}, http.StatusOK)
m := mux.NewRoute()
m.GET("/hello/:id", func(w http.ResponseWriter, req *http.Request, params httprouter.Params) {
pp := req.URL.Query()
logger.Info("query params:", params, pp)
mux.JSON(w, req, []string{"hello world"}, http.StatusOK)
})
log.Fatal(m.Run(":8080"))
}
Expand Down
4 changes: 2 additions & 2 deletions test/netpoll.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ package main

import (
"bufio"
"github.com/julienschmidt/httprouter"
"github.com/php2go/netpollmux/internal/logger"
"log"
"net"
"net/http"
"sync"

"github.com/julienschmidt/httprouter"
"github.com/php2go/netpollmux/internal/logger"
"github.com/php2go/netpollmux/mux"
"github.com/php2go/netpollmux/netpoll"
)
Expand Down

0 comments on commit dff7436

Please sign in to comment.