Mock API
This commit is contained in:
parent
be8ff3466a
commit
a9be05854c
11 changed files with 331 additions and 12 deletions
37
api/routines.go
Normal file
37
api/routines.go
Normal file
|
@ -0,0 +1,37 @@
|
|||
package api
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
|
||||
"git.nemunai.re/nemunaire/reveil/config"
|
||||
)
|
||||
|
||||
func declareRoutinesRoutes(cfg *config.Config, router *gin.RouterGroup) {
|
||||
router.GET("/routines", func(c *gin.Context) {
|
||||
|
||||
})
|
||||
router.POST("/routines", func(c *gin.Context) {
|
||||
|
||||
})
|
||||
|
||||
routinesRoutes := router.Group("/routines/:gid")
|
||||
routinesRoutes.Use(routineHandler)
|
||||
|
||||
routinesRoutes.GET("", func(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, c.MustGet("routine"))
|
||||
})
|
||||
routinesRoutes.PUT("", func(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, c.MustGet("routine"))
|
||||
})
|
||||
routinesRoutes.DELETE("", func(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, c.MustGet("routine"))
|
||||
})
|
||||
}
|
||||
|
||||
func routineHandler(c *gin.Context) {
|
||||
c.Set("routine", nil)
|
||||
|
||||
c.Next()
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue