-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d9016a5
commit 84acfbf
Showing
12 changed files
with
1,364 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,5 @@ tmp/ | |
local/ | ||
|
||
prompage.yaml | ||
internal/resources/static/tailwind.css | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ tasks: | |
serve: | ||
desc: Run the http server | ||
cmds: | ||
- go generate | ||
- go run main.go serve | ||
|
||
docker:build: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package http | ||
|
||
import ( | ||
"bytes" | ||
"html/template" | ||
"log" | ||
"net/http" | ||
|
||
"github.com/henrywhitaker3/prompage/internal/app" | ||
"github.com/henrywhitaker3/prompage/internal/config" | ||
"github.com/henrywhitaker3/prompage/internal/resources/views" | ||
"github.com/labstack/echo/v4" | ||
) | ||
|
||
func NewStatusPageHandler(app *app.App) echo.HandlerFunc { | ||
tmpl := template.Must(template.ParseFS(views.Views, "index.html")) | ||
|
||
return func(c echo.Context) error { | ||
var buf bytes.Buffer | ||
data := struct { | ||
Config config.Config | ||
}{ | ||
Config: *app.Config, | ||
} | ||
if err := tmpl.Execute(&buf, data); err != nil { | ||
log.Printf("ERROR - could not render template: %s", err) | ||
return err | ||
} | ||
|
||
return c.HTML(http.StatusOK, buf.String()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package static | ||
|
||
import "embed" | ||
|
||
var ( | ||
//go:embed * | ||
FS embed.FS | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<link rel="stylesheet" href="/static/tailwind.css" /> | ||
<title>{{ .Config.UI.Title }}</title> | ||
</head> | ||
<body> | ||
<h1 class="text-2xl text-red-500">body here...</h1> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package views | ||
|
||
import "embed" | ||
|
||
var ( | ||
//go:embed * | ||
Views embed.FS | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.