diff options
author | MikunoNaka <bokuwakanojogahoshii@yahoo.com> | 2021-07-08 09:11:45 +0530 |
---|---|---|
committer | MikunoNaka <bokuwakanojogahoshii@yahoo.com> | 2021-07-08 09:11:45 +0530 |
commit | 165d47723a484ba84acf13d62f7ae8e4f1392347 (patch) | |
tree | 1cf092e8aa05e5037e9cd8a6f4bf2dd1696ef729 /server/router/people.go | |
parent | 177427b5821a67e141236e6aeb4db12d76b050a0 (diff) |
polished how POST requests work on both front and back end
Diffstat (limited to 'server/router/people.go')
-rw-r--r-- | server/router/people.go | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/server/router/people.go b/server/router/people.go index bdb74a8..25d5353 100644 --- a/server/router/people.go +++ b/server/router/people.go @@ -22,12 +22,7 @@ func getAllPeople(ctx *gin.Context) { } func registerPerson(ctx *gin.Context) { - person := db.Person { - Name: ctx.Query("name"), - Address: ctx.Query("address"), - Phone: ctx.Query("phone"), - Email: ctx.Query("email"), - } - - db.RegisterPerson(person) + var newPerson db.Person + ctx.Bind(&newPerson) + db.RegisterPerson(newPerson) } |