我使用 angular 来获取信息注册 html 并且我发布到路径 api 它工作但打印单词“工作”并且我无法在正文中获得价值并且我测试路径后使用邮递员它显示名字............ ..................................................... ..................................................... ..................................
服务器.go
package main
import (
"github.com/gorilla/handlers"
"github.com/gorilla/mux"
"net/http"
)
func main() {
router := mux.NewRouter()
router.HandleFunc("/register", Createuser).Methods("POST")
headers := handlers.AllowedHeaders([]string{"X-Requested-With", "Content-Type", "Authorization"})
methods := handlers.AllowedMethods([]string{"GET", "POST", "PUT", "DELETE"})
origins := handlers.AllowedOrigins([]string{"*"})
http.ListenAndServe(":12345", handlers.CORS(headers, methods, origins)(router))
}
func Createuser(writer http.ResponseWriter, request *http.Request) {
request.ParseForm()
print(request.FormValue("firstName"))
print("work")
}
大话西游666
相关分类