-
Notifications
You must be signed in to change notification settings - Fork 0
/
handler.go
52 lines (43 loc) · 986 Bytes
/
handler.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package webapp
import (
"net/http"
"github.com/jksch/cc/internal/webapp/static"
"github.com/maxence-charriere/go-app/v7/pkg/app"
)
// New creates a new courses app http handler.
func New() http.Handler {
return &app.Handler{
Title: "Courses app",
Author: "jksch",
Resources: &staticFS{
Handler: http.FileServer(static.FS(false)),
},
Icon: app.Icon{
Default: "/gopher_192.png",
Large: "/gopher_512.png",
},
LoadingLabel: "App is loading! Gophers are working on it...",
Styles: []string{
"/bootstrap.css",
},
}
}
//go:generate make assable
type staticFS struct {
http.Handler
}
func (s staticFS) AppResources() string {
return ""
}
func (s staticFS) StaticResources() string {
return "/web"
}
func (s staticFS) AppWASM() string {
return s.StaticResources() + "/app.wasm"
}
func (s staticFS) RobotsTxt() string {
return s.StaticResources() + "/robots.txt"
}
func (s staticFS) AdsTxt() string {
return s.StaticResources() + "/ads.txt"
}