added POST-endpoint for userform

Co-authored-by: haraldnilsen <harald_998@hotmail.com>
Signed-off-by: Sindre Kjelsrud <kjelsrudsindre@gmail.com>
This commit is contained in:
Sindre Kjelsrud 2023-12-21 19:31:14 +01:00
parent b78003b4fc
commit dd8f22b043
Signed by untrusted user who does not match committer: sidski
GPG key ID: D2BBDF3EDE6BA9A6
7 changed files with 74 additions and 18 deletions

View file

@ -1,6 +1,8 @@
package main
import (
"fmt"
"io"
"net/http"
"github.com/gin-gonic/gin"
@ -16,6 +18,15 @@ func main() {
})
})
// Info about user
router.POST("/submitform", func(c *gin.Context) {
jsonData, err := io.ReadAll(c.Request.Body)
if err != nil {
// Handle error
}
fmt.Print(string(jsonData))
})
// Run the server on port 8080
router.Run(":8080")
}