Added /time endpoint for better sync experience
This commit is contained in:
parent
21e5b31471
commit
975c031bd8
@ -2,6 +2,7 @@ package httpapi
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"watch-party-backend/internal/repo"
|
||||
"watch-party-backend/internal/service"
|
||||
@ -17,6 +18,15 @@ func NewRouter(svc service.EpisodeService) *gin.Engine {
|
||||
c.JSON(http.StatusOK, gin.H{"status": "ok"})
|
||||
})
|
||||
|
||||
r.GET("/time", func(c *gin.Context) {
|
||||
now := time.Now().UTC().UnixMilli()
|
||||
|
||||
c.Header("Cache-Control", "no-store, max-age=0, must-revalidate")
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"now": now,
|
||||
})
|
||||
})
|
||||
|
||||
v1 := r.Group("/v1")
|
||||
|
||||
// GET /v1/current
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user