personal-website/routes/new.go

47 lines
805 B
Go

package routes
import (
"github.com/gin-gonic/gin"
"log"
"net/http"
"personalwebsite/webfs"
)
func ApiRoutes() {
router := gin.New()
router.GET("/", func(ctx *gin.Context) {
ctx.String(http.StatusOK, "index.tmpl")
})
libGroup := router.Group("lib")
webFSGroup := libGroup.Group("fs")
webFSGroup.POST("write", func(context *gin.Context) {
//err := webfs.Crea()
//if err != nil {
// print()
//}
})
webFSGroup.POST("create/dir", func(context *gin.Context) {
_, err := webfs.CreateRoot(context)
if err != nil {
print(err.Error())
}
})
webFSGroup.POST("create/root", func(context *gin.Context) {
_, err := webfs.CreateRoot(context)
if err != nil {
print(err.Error())
}
})
err := router.Run(":" + "5000")
if err != nil {
log.Panicf("error: %s", err)
}
}