feat: initial login page

with separate file for future util endpoints,
also dummy sessions inteface
This commit is contained in:
efim
2023-10-29 08:26:35 +00:00
parent c19eb9104e
commit bde58a0eab
9 changed files with 273 additions and 29 deletions

View File

@@ -5,6 +5,8 @@ import (
"html/template"
"log"
"net/http"
"sunshine.industries/some-automoderation/sessions"
)
//go:embed templates
@@ -13,13 +15,15 @@ var templateFs embed.FS
//go:embed static
var staticFilesFs embed.FS
func RegisterRoutes() {
func RegisterRoutes(sessions *sessions.DummySM) {
// login page
registerLoginRoutes(&templateFs, sessions)
// main page template
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
var templFile = "templates/index.gohtml"
tmpl := template.Must(template.ParseFS(templateFs, templFile))
err := tmpl.Execute(w, 15)
err := tmpl.Execute(w, nil)
if err != nil {
log.Printf("my error in executing template, huh\n %s", err)
}