-
Notifications
You must be signed in to change notification settings - Fork 15
/
about.go
36 lines (29 loc) 路 985 Bytes
/
about.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package handler
import (
"html/template"
"net/http"
"github.com/number571/go-peer/cmd/hidden_lake/applications/messenger/internal/config"
"github.com/number571/go-peer/cmd/hidden_lake/applications/messenger/web"
"github.com/number571/go-peer/pkg/logger"
hlm_settings "github.com/number571/go-peer/cmd/hidden_lake/applications/messenger/pkg/settings"
http_logger "github.com/number571/go-peer/internal/logger/http"
)
func AboutPage(pLogger logger.ILogger, pCfg config.IConfig) http.HandlerFunc {
return func(pW http.ResponseWriter, pR *http.Request) {
logBuilder := http_logger.NewLogBuilder(hlm_settings.CServiceName, pR)
if pR.URL.Path != "/about" {
NotFoundPage(pLogger, pCfg)(pW, pR)
return
}
t, err := template.ParseFS(
web.GetTemplatePath(),
"index.html",
"about.html",
)
if err != nil {
panic("can't load hmtl files")
}
pLogger.PushInfo(logBuilder.WithMessage(http_logger.CLogSuccess))
_ = t.Execute(pW, getTemplate(pCfg))
}
}