I’m writing the REST API without using the gorilla lib and when I do the PUT request , it throws 404.I always seen examples using the gorilla. without gorilla how can I solve the below problem.
adding to the above, what is the adv of using the gorilla
mux.HandleFunc("/Employee/{id}", handleEmployee)
func handleEmployee(writer http.ResponseWriter, request *http.Request) {
switch request.Method {
case “GET”:
case “POST”:
case “PUT”:
pathValues := request.URL.Query() //return map
empid := pathValues.Get(“id”)
println("the emp id is ", empid)
case “DELETE”:
default:
println(“None of the methods other than above are allowed”)
}
}
Hi,
post method is working without writing something to the writer
Every example uses the gorilla mux newrouter way.i want to use golang package http with newservemux
Until a well argumented reason stop you to use dependencies you can use with trust gorilla/mux because it’s pretty hard to handle routes only with standard library.