creating...

This commit is contained in:
YouROK
2020-11-09 16:45:06 +03:00
parent 0b09da2490
commit 1d4acc1406
12 changed files with 710 additions and 55 deletions

View File

@@ -0,0 +1,32 @@
package api
import (
"github.com/gin-gonic/gin"
"server/torr"
"server/version"
)
type requestI struct {
Action string `json:"action,omitempty"`
}
type responseI struct {
}
var bts *torr.BTServer
func SetupRouteApi(route *gin.Engine, serv *torr.BTServer) {
bts = serv
route.GET("/echo", echo)
route.POST("/settings", settings)
route.POST("/torrents", torrents)
route.GET("/stream", stream)
route.GET("/stream/*fname", stream)
}
func echo(c *gin.Context) {
c.String(200, "{\"version\": \"%v\"}", version.Version)
}