mirror of
https://github.com/onsonr/sonr.git
synced 2025-03-10 21:09:11 +00:00
40 lines
842 B
Go
40 lines
842 B
Go
package main
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/labstack/echo/v4"
|
|
"github.com/labstack/gommon/log"
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/onsonr/sonr/pkg/nebula"
|
|
"github.com/onsonr/sonr/pkg/nebula/pages"
|
|
)
|
|
|
|
func NewProxyCmd() *cobra.Command {
|
|
return &cobra.Command{
|
|
Use: "start",
|
|
Short: "Starts the DWN proxy server for the local IPFS node",
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
// Echo instance
|
|
e := echo.New()
|
|
e.Logger.SetLevel(log.INFO)
|
|
|
|
// Configure the server
|
|
if err := nebula.UseAssets(e); err != nil {
|
|
e.Logger.Fatal(err)
|
|
}
|
|
|
|
e.GET("/", pages.Home)
|
|
e.GET("/login", pages.Login)
|
|
e.GET("/register", pages.Register)
|
|
e.GET("/profile", pages.Profile)
|
|
e.GET("/allocate", pages.Profile)
|
|
|
|
if err := e.Start(":1323"); err != http.ErrServerClosed {
|
|
log.Fatal(err)
|
|
}
|
|
},
|
|
}
|
|
}
|