mirror of
https://github.com/supanadit/geo-smart-system.git
synced 2024-11-10 01:52:24 +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-contrib/sse"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/go-redis/redis"
|
"github.com/go-redis/redis"
|
||||||
|
"github.com/rs/xid"
|
||||||
"github.com/supanadit/geosmartsystem/model"
|
"github.com/supanadit/geosmartsystem/model"
|
||||||
"github.com/supanadit/geosmartsystem/model/tile38"
|
"github.com/supanadit/geosmartsystem/model/tile38"
|
||||||
"net/http"
|
"net/http"
|
||||||
@ -16,12 +17,9 @@ func main() {
|
|||||||
})
|
})
|
||||||
r := gin.Default()
|
r := gin.Default()
|
||||||
r.Use(cors.Default())
|
r.Use(cors.Default())
|
||||||
r.GET("/get/unique/id", func(c *gin.Context) {
|
r.GET("/unique/id", func(c *gin.Context) {
|
||||||
var location model.Location
|
id := xid.New()
|
||||||
_ = c.BindJSON(&location)
|
c.JSON(200, gin.H{"id": id.String()})
|
||||||
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) {
|
r.POST("/set/point", func(c *gin.Context) {
|
||||||
var location model.Location
|
var location model.Location
|
||||||
|
Loading…
Reference in New Issue
Block a user