mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-02 17:31:39 +00:00
refactor: move DWN proxy server logic to separate file
This commit is contained in:
@@ -1,3 +1,49 @@
|
||||
# Nebula
|
||||
|
||||
A Templ component library for the Sonr DWN (Decentralized Web Node) client.
|
||||
|
||||
## Overview
|
||||
|
||||
### 3rd Party
|
||||
|
||||
- [htmx](https://htmx.org/)
|
||||
- [tailwindcss](https://tailwindcss.com/)
|
||||
- [templ](https://templ.dev/)
|
||||
- [alpinejs](https://alpinejs.dev/)
|
||||
|
||||
### Components
|
||||
|
||||
- Navbar
|
||||
- Footer
|
||||
- Login
|
||||
- Register
|
||||
- Profile
|
||||
- Authorize
|
||||
|
||||
## Usage
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/onsonr/sonr/nebula"
|
||||
"github.com/onsonr/sonr/nebula/components"
|
||||
"github.com/onsonr/sonr/nebula/pages"
|
||||
)
|
||||
|
||||
func main() {
|
||||
e := echo.New()
|
||||
e.Use(nebula.UseAssets)
|
||||
e.GET("/", pages.Home)
|
||||
e.GET("/login", pages.Login)
|
||||
e.GET("/register", pages.Register)
|
||||
e.GET("/profile", pages.Profile)
|
||||
e.GET("/authorize", pages.Authorize)
|
||||
e.GET("/components", components.Home)
|
||||
e.Logger.Fatal(e.Start(":1323"))
|
||||
}
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
Vendored
@@ -1,24 +0,0 @@
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.12.0/.schema/devbox.schema.json",
|
||||
"packages": [
|
||||
"bun@latest"
|
||||
],
|
||||
"env": {
|
||||
"CLOUDFLARE_API_TOKEN": "$CLOUDFLARE_API_TOKEN",
|
||||
"GOPATH": "$HOME/go",
|
||||
"PATH": "$HOME/go/bin:$PATH",
|
||||
"TEMPL_EXPERIMENT": "rawgo",
|
||||
"CHAIN_ID": "sonr-testnet-1",
|
||||
"DENOM": "usnr",
|
||||
"KEYRING": "test",
|
||||
"MONIKER": "florence",
|
||||
"ENV": "$ENVIRONMENT"
|
||||
},
|
||||
"shell": {
|
||||
"scripts": {
|
||||
"build": [
|
||||
"make build"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +1,31 @@
|
||||
package nebula
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"io/fs"
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
//go:embed assets
|
||||
var embeddedFiles embed.FS
|
||||
|
||||
func getFileSystem(useOS bool) http.FileSystem {
|
||||
if useOS {
|
||||
return http.FS(os.DirFS("assets"))
|
||||
}
|
||||
|
||||
fsys, err := fs.Sub(embeddedFiles, "assets")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return http.FS(fsys)
|
||||
}
|
||||
|
||||
func UseAssets(e *echo.Echo) echo.HandlerFunc {
|
||||
assets := http.FileServer(getFileSystem(true))
|
||||
return echo.WrapHandler(assets)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user