Skip to content
Snippets Groups Projects
Commit b0fd0043 authored by Jonas Kjærandsen's avatar Jonas Kjærandsen
Browse files

URL parameter retrieval in the request (golang)

parent d885c3a7
No related branches found
No related tags found
No related merge requests found
package main
import (
"fmt"
"log"
"net/http"
......@@ -23,6 +24,12 @@ func main() {
r.Static("/img", "./Tailwind/img")
r.GET("/", func(c *gin.Context) {
fmt.Print("The input text is: ")
// All parameters in the url can be retrieved with the c.Request.Url.Query() command
// Returns a map of all the items, can be used for parsing several values / put into a struct?
fmt.Println(c.Request.URL.Query()["inputText"])
c.HTML(http.StatusOK, "index.html", gin.H{
"isSelected": true,
})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment