Last active
September 28, 2018 21:34
-
-
Save joshrotenberg/dd1c69a6724ba38fa57f2fa0411a9afa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "net/http" | |
| "github.com/gin-gonic/gin" | |
| ) | |
| func main() { | |
| router := gin.Default() | |
| router.POST("/post", func(c *gin.Context) { | |
| fmt.Println(c) | |
| id := c.Query("id") | |
| page := c.DefaultQuery("page", "0") | |
| name := c.PostForm("name") | |
| message := c.PostForm("message") | |
| c.String(http.StatusOK, fmt.Sprintf("id: %s; page: %s; name: %s; message: %s", id, page, name, message)) | |
| }) | |
| router.Run(":8080") | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment