35 lines
663 B
Go
35 lines
663 B
Go
package router
|
|
|
|
import (
|
|
"git.zhouxhere.com/zhouxhere/syz/router/auth"
|
|
"git.zhouxhere.com/zhouxhere/syz/store"
|
|
"github.com/labstack/echo/v4"
|
|
echoSwagger "github.com/swaggo/echo-swagger"
|
|
|
|
_ "git.zhouxhere.com/zhouxhere/syz/docs"
|
|
)
|
|
|
|
type IRouter interface {
|
|
RegisterRoutes() error
|
|
}
|
|
|
|
type Router struct {
|
|
*echo.Echo
|
|
store *store.Store
|
|
}
|
|
|
|
func NewRouter(store *store.Store, echoServer *echo.Echo) *Router {
|
|
return &Router{
|
|
Echo: echoServer,
|
|
store: store,
|
|
}
|
|
}
|
|
|
|
func (r *Router) RegisterRoutes() error {
|
|
r.GET("/swagger/*", echoSwagger.WrapHandler)
|
|
|
|
authRouter := auth.NewAuthRouter("auth", r.store, r.Echo)
|
|
authRouter.RegisterRoutes()
|
|
return nil
|
|
}
|