mirror of
https://github.com/supanadit/geo-smart-system.git
synced 2025-01-31 21:08:56 +00:00
Endpoint Change, and Can Request Unique ID from System
This commit is contained in:
parent
e7a3a34114
commit
5c78bf9ddb
10
main.go
10
main.go
@ -5,6 +5,7 @@ import (
|
||||
"github.com/gin-contrib/sse"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-redis/redis"
|
||||
"github.com/rs/xid"
|
||||
"github.com/supanadit/geosmartsystem/model"
|
||||
"github.com/supanadit/geosmartsystem/model/tile38"
|
||||
"net/http"
|
||||
@ -16,12 +17,9 @@ func main() {
|
||||
})
|
||||
r := gin.Default()
|
||||
r.Use(cors.Default())
|
||||
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.GET("/unique/id", func(c *gin.Context) {
|
||||
id := xid.New()
|
||||
c.JSON(200, gin.H{"id": id.String()})
|
||||
})
|
||||
r.POST("/set/point", func(c *gin.Context) {
|
||||
var location model.Location
|
||||
|
Loading…
Reference in New Issue
Block a user