This is a creation in Article, where the information may have evolved or changed.
First of all, you need this package: "Net/http" This package is included in the native go, just use it.
Func Checkservice (w http. Responsewriter, R *http. Request) {//This line resolves an incoming parameter, and the default is r that is not resolved. Parseform ()//This will print all incoming parameters in the form of: Map[key:value] to the console FMT. PRINTLN (R.form)//The pathfmt of the request will be printed here. Println ("Path:", R.url. Path)//Here print the defined scheme such as: http, mailto, etc. fmt. PRINTLN ("scheme", R.url. Scheme)//directly print the value of keytest0001 FMT. Println (r.form["keytest0001"])//traverse mapfor k, V: = Range R.form {fmt. Println ("Key:", K) fmt. Println ("Val:", Strings. Join (V, ""))}//if you want to output to the Web page, use the following code (the project needs to be UTF-8 encoded, otherwise error) FMT. fprintf (W, "Background app started successfully")}//the following is the main method: Func main () {//Bind the requested path and method http. Handlefunc ("/", Checkservice)//Listener port 8888err: = http. Listenandserve (": 8888", nil) if err! = Nil {log. Fatal ("Listenandserve:", Err)}}