mirror of
https://github.com/onsonr/sonr.git
synced 2025-03-10 21:09:11 +00:00
- **feat: remove grant page** - **refactor: remove alert, input, radios, tabs, and video blocks** - **feat: add JSON serialization to DWN config** - **feat: add new Highway gateway component** - **refactor: remove unused chains.yaml and devbox.json** - **refactor: Separate request and response headers into protected and non-protected structs** - **feat: Update the UseSession echo middleware to bind the correct headers and provide methods for updating HTMX context from Go** - **refactor: remove unused headers from session** - **feat: add authorize endpoint** - **feat: create marketing pages**
41 lines
771 B
Go
41 lines
771 B
Go
package server
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/labstack/echo/v4"
|
|
"github.com/labstack/gommon/log"
|
|
|
|
"github.com/onsonr/sonr/internal/session"
|
|
"github.com/onsonr/sonr/pkg/nebula"
|
|
"github.com/onsonr/sonr/pkg/nebula/router"
|
|
)
|
|
|
|
type Server struct {
|
|
*echo.Echo
|
|
}
|
|
|
|
func New() *Server {
|
|
s := &Server{Echo: echo.New()}
|
|
s.Logger.SetLevel(log.INFO)
|
|
s.Use(session.UseSession)
|
|
|
|
// Configure the server
|
|
if err := nebula.UseAssets(s.Echo); err != nil {
|
|
s.Logger.Fatal(err)
|
|
}
|
|
|
|
s.GET("/", router.Home)
|
|
s.GET("/login", router.Login)
|
|
s.GET("/register", router.Register)
|
|
s.GET("/profile", router.Profile)
|
|
s.GET("/authorize", router.Authorize)
|
|
return s
|
|
}
|
|
|
|
func (s *Server) Start() {
|
|
if err := s.Echo.Start(":1323"); err != http.ErrServerClosed {
|
|
log.Fatal(err)
|
|
}
|
|
}
|