lorem ipsum intro
lorem ipsum intro
package main
import (
"log"
"net/http"
"github.com/bitrise-io/bitrise-oauth/service"
)
func main() {
handler := func(w http.ResponseWriter, r *http.Request) {}
mux := http.NewServeMux()
validator := service.NewValidator()
mux.HandleFunc("/test_func", validator.HandlerFunc(handler))
log.Fatal(http.ListenAndServe(":8080", mux))
}
package main
import (
"log"
"net/http"
"github.com/bitrise-io/bitrise-oauth/service"
"github.com/gorilla/mux"
)
func main() {
handler := func(w http.ResponseWriter, r *http.Request) {}
router := mux.NewRouter()
validator := service.NewValidator()
router.HandleFunc("/test_func", validator.HandlerFunc(handler)).Methods(http.MethodGet)
http.Handle("/", router)
log.Fatal(http.ListenAndServe(":8080", router))
}
package main
import (
"log"
"net/http"
"github.com/bitrise-io/bitrise-oauth/service"
)
func main() {
handler := func(w http.ResponseWriter, r *http.Request) {}
mux := http.NewServeMux()
validator := service.NewValidator()
mux.Handle("/test", validator.Middleware(http.HandlerFunc(handler)))
log.Fatal(http.ListenAndServe(":8080", mux))
}
package main
import (
"log"
"net/http"
"github.com/bitrise-io/bitrise-oauth/service"
"github.com/gorilla/mux"
)
func main() {
handler := func(w http.ResponseWriter, r *http.Request) {}
router := mux.NewRouter()
validator := service.NewValidator()
router.Handle("/test", validator.Middleware(http.HandlerFunc(handler))).Methods(http.MethodGet)
http.Handle("/", router)
log.Fatal(http.ListenAndServe(":8080", router))
}
package main
import (
"net/http"
"github.com/bitrise-io/bitrise-oauth/service"
"github.com/labstack/echo"
)
func main() {
handler := func(c echo.Context) error {
return c.String(http.StatusOK, "Hello, World!")
}
e := echo.New()
validator := service.NewValidator()
e.Use(validator.MiddlewareFunc())
e.GET("/test", handler)
e.Logger.Fatal(e.Start(":8080"))
}
validator := service.NewValidator()
handler := func(c echo.Context) error {
if err := validator.ValidateRequest(c.Request()); err != nil {
return err
}
return c.String(http.StatusOK, "Hello, World!")
}
e := echo.New()
e.GET("/test", handler)
e.Logger.Fatal(e.Start(":8080"))
- Clone this project under
$GOPATH/src/github.com/bitrise-io/bitrise-oauth
- Run
godoc -http=:6060 &
- Open the documentation: http://localhost:6060/pkg/github.com/bitrise-io/bitrise-oauth
go get golang.org/x/tools/cmd/godoc