mirror of
https://github.com/onsonr/sonr.git
synced 2025-03-11 13:29:12 +00:00
- **feat: add documentation and GitHub Actions workflow for publishing documentation** - **docs(concepts): add documentation for chain modules** - **refactor: Simplify session management with SQLite storage and remove deprecated code** - **refactor: Simplify database initialization and remove DatabaseContext** - **refactor: move connection handling logic to resolver package** - **feat: implement session management with database persistence** - **feat: Ensure config directory exists when creating database path** - **feat: Add SetUserHandle function to set user handle in session** - **feat: Add public methods to set session fields with database save** - **refactor: Remove unused session setter functions** - **feat: Add getter methods for all Session Model properties** - **feat: enhance Session model with user name details** - **feat: add Motr support and update UI elements** - **<no value>** - **feat: Add unique handle constraint and method to check handle existence** - **docs: update site URL to onsonr.dev** - **fix: correct import statement for database package** - **test: updated CI to run tests on pull requests and merge groups** - **docs: remove reference to develop branch in workflow** - **feat: add WebAuthn support for user registration** - **fix: correct smart account attenuation preset name** - **feat: add ComputeIssuerDID and ComputeSonrAddr functions to ucan package** - **test: add unit tests for MPC keyset and keyshare** - **feat: introduce new script to streamline GitHub issue creation**
33 lines
959 B
Go
33 lines
959 B
Go
// Package gateway provides the default routes for the Sonr hway.
|
|
package gateway
|
|
|
|
import (
|
|
"github.com/labstack/echo/v4"
|
|
"github.com/onsonr/sonr/pkg/common/response"
|
|
"github.com/onsonr/sonr/pkg/gateway/config"
|
|
"github.com/onsonr/sonr/pkg/gateway/handlers"
|
|
"github.com/onsonr/sonr/pkg/gateway/internal/database"
|
|
"github.com/onsonr/sonr/pkg/gateway/internal/session"
|
|
)
|
|
|
|
func RegisterRoutes(e *echo.Echo, env config.Env) error {
|
|
// Custom error handler for gateway
|
|
e.HTTPErrorHandler = response.RedirectOnError("http://localhost:3000")
|
|
|
|
// Initialize database
|
|
db, err := database.InitDB(env)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
// Inject session middleware with database connection
|
|
e.Use(session.Middleware(db))
|
|
|
|
// Register routes
|
|
e.GET("/", handlers.HandleIndex)
|
|
e.GET("/register", handlers.HandleRegisterView(env))
|
|
e.POST("/register/start", handlers.HandleRegisterStart)
|
|
e.POST("/register/finish", handlers.HandleRegisterFinish)
|
|
return nil
|
|
}
|