You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
998 B
Go

3 years ago
/**
* @Author: jager
* @Email: lhj168os@gmail.com
* @File: api
* @Date: 2021/12/31 2:34
* @package: api
* @Version: v1.0.0
*
* @Description:
*
*/
package api
import (
3 years ago
"github.com/jageros/hawox/jwt"
"idata/internal/service/almanac"
3 years ago
"idata/internal/service/dirty"
3 years ago
"idata/internal/service/soup"
"idata/internal/service/user"
3 years ago
"net/http"
3 years ago
"github.com/gin-gonic/gin"
)
func Registry(engine *gin.Engine) {
3 years ago
engine.GET("/my-ip", myIp)
3 years ago
r := engine.Group("/haw")
ur := r.Group("/user")
ur.POST("/register", user.Register)
ur.POST("/login", user.Login)
3 years ago
ur.GET("/info", jwt.CheckToken, user.Info)
ur.GET("/secret", jwt.CheckToken, user.Secret)
3 years ago
ur.GET("/openapi", jwt.CheckToken, user.OpenApi)
3 years ago
apiR := r.Group("/api")
3 years ago
apiR.GET("/soup", soup.GetRandSoup)
3 years ago
apiR.GET("/almanac", almanac.Almanac)
3 years ago
apiR.GET("/dirty_word", dirty.IsDirtyWord)
3 years ago
apiR.Static("/video", "./static/")
3 years ago
}
func myIp(ctx *gin.Context) {
3 years ago
addr := ctx.ClientIP()
3 years ago
ctx.String(http.StatusOK, addr)
3 years ago
}