Skip to content

Instantly share code, notes, and snippets.

@jeffotoni
Created March 27, 2017 20:43
Show Gist options
  • Save jeffotoni/bcc6b2e2c43769b70e51b5a949ecee13 to your computer and use it in GitHub Desktop.
Save jeffotoni/bcc6b2e2c43769b70e51b5a949ecee13 to your computer and use it in GitHub Desktop.
/** @autor jeffotoni */
package main
import (
"fmt"
"log"
"net/http"
"github.com/gorilla/mux"
)
func main() {
fmt.Println("Conect port : 4002")
fmt.Println("Instance /register")
///create route
router := mux.NewRouter().StrictSlash(true)
router.
HandleFunc("/register", func(w http.ResponseWriter, r *http.Request) {
fmt.Println(r.Method)
})
// router.haHandleFunc("/register", Teste2).
// Methods("POST")
log.Fatal(http.ListenAndServe(":4002", router))
}
func Teste(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "http teste ... ")
}
func Teste2(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "http teste 2... ")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment