For example if the website is https://www.example.com/signup?campaign='new_york', I would like to strip out the value of campaign, 'new_york'. Thanks!
For example if the website is https://www.example.com/signup?campaign='new_york', I would like to strip out the value of campaign, 'new_york'. Thanks!
You should find the query parameters by using this
campaign := r.URL.Query().Get("campaign")
You should get the query string value by this code:
http.HandleFunc("/signup", func(w http.ResponseWriter, r *http.Request) {
q := r.URL.Query()
campaign := q.Get("campaign")
fmt.Println("campaign =>", campaign)
})
http.ListenAndServe(":8000", nil)