mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-04 02:11:40 +00:00
24 lines
585 B
Go
24 lines
585 B
Go
package gateway
|
|||
|
|
|
||
|
|
import (
|
||
|
|
"net/http"
|
||
|
|
|
||
|
|
"github.com/labstack/echo/v4"
|
||
|
|
"github.com/onsonr/sonr/pkg/gateway/handlers"
|
||
|
|
)
|
||
|
|
|
||
|
|
func RegisterRoutes(e *echo.Echo) {
|
||
|
|
// Custom error handler for gateway
|
||
|
|
e.HTTPErrorHandler = func(err error, c echo.Context) {
|
||
|
|
if he, ok := err.(*echo.HTTPError); ok {
|
||
|
|
// Log the error if needed
|
||
|
|
c.Logger().Errorf("Gateway error: %v", he.Message)
|
||
|
|
}
|
||
|
|
// Redirect to main site
|
||
|
|
c.Redirect(http.StatusFound, "http://localhost:3000")
|
||
|
|
}
|
||
|
|
e.POST("/spawn", handlers.SpawnVault)
|
||
|
|
e.POST("/pin", handlers.PinVault)
|
||
|
|
e.POST("/publish", handlers.PublishVault)
|
||
|
|
}
|