feat: migrate system to api v1

This commit is contained in:
Steven
2023-06-20 17:15:12 +08:00
parent 96704162d8
commit 24d42694c8
6 changed files with 31 additions and 35 deletions

View File

@ -12,14 +12,14 @@ import (
// Profile is the configuration to start main server.
type Profile struct {
// Data is the data directory
Data string `json:"-"`
// DSN points to where Shortify stores its own data
DSN string `json:"-"`
// Mode can be "prod" or "dev"
Mode string `json:"mode"`
// Port is the binding port for server
Port int `json:"port"`
// Data is the data directory
Data string `json:"data"`
// DSN points to where Shortify stores its own data
DSN string `json:"dsn"`
// Version is the current version of server
Version string `json:"version"`
}

View File

@ -64,7 +64,6 @@ func NewServer(profile *profile.Profile, store *store.Store) (*Server, error) {
apiGroup.Use(func(next echo.HandlerFunc) echo.HandlerFunc {
return JWTMiddleware(s, next, string(secret))
})
s.registerSystemRoutes(apiGroup)
s.registerWorkspaceUserRoutes(apiGroup)
s.registerShortcutRoutes(apiGroup)

View File

@ -1,23 +0,0 @@
package server
import (
"net/http"
"github.com/boojack/shortify/api"
"github.com/labstack/echo/v4"
)
func (s *Server) registerSystemRoutes(g *echo.Group) {
g.GET("/ping", func(c echo.Context) error {
return c.JSON(http.StatusOK, composeResponse(s.Profile))
})
g.GET("/status", func(c echo.Context) error {
systemStatus := api.SystemStatus{
Profile: s.Profile,
}
return c.JSON(http.StatusOK, composeResponse(systemStatus))
})
}