Endpoint Change

This commit is contained in:
Supan Adit Pratama 2019-10-31 20:56:26 +07:00
parent f5d2feaa09
commit e7a3a34114
3 changed files with 12 additions and 2 deletions

4
.gitignore vendored
View File

@ -2,5 +2,7 @@
.vscode
/public
/assets
!/public/.gitkeep
!/public/.gitkeep
!/assets/.gitkeep

0
assets/.gitkeep Normal file
View File

10
main.go
View File

@ -16,7 +16,14 @@ func main() {
})
r := gin.Default()
r.Use(cors.Default())
r.POST("/set-points", func(c *gin.Context) {
r.GET("/get/unique/id", func(c *gin.Context) {
var location model.Location
_ = c.BindJSON(&location)
c.Writer.Header().Set("Content-Type", "application/json")
client.Do("SET", location.Type, location.Id, "POINT", location.Lat, location.Lng)
c.JSON(200, gin.H{"status": "ok"})
})
r.POST("/set/point", func(c *gin.Context) {
var location model.Location
_ = c.BindJSON(&location)
c.Writer.Header().Set("Content-Type", "application/json")
@ -41,5 +48,6 @@ func main() {
}
})
r.Static("/public", "./public")
r.Static("/assets", "./assets")
_ = r.Run()
}