added build script
This commit is contained in:
@@ -4,3 +4,4 @@ test-db.sqlite*
|
|||||||
*_templ.go
|
*_templ.go
|
||||||
node_modules/
|
node_modules/
|
||||||
styles.css
|
styles.css
|
||||||
|
mmaschedule
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
main() {
|
||||||
|
cd src/ || return
|
||||||
|
bun run build
|
||||||
|
templ generate
|
||||||
|
go build -o mmaschedule
|
||||||
|
}
|
||||||
|
|
||||||
|
main
|
||||||
+3
-6
@@ -11,8 +11,8 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:generate bun run build
|
//go:embed static/*
|
||||||
//go:generate templ generate
|
var staticfiles embed.FS
|
||||||
|
|
||||||
func RunServer(addr string, queries *event.Queries) error {
|
func RunServer(addr string, queries *event.Queries) error {
|
||||||
mux := http.NewServeMux()
|
mux := http.NewServeMux()
|
||||||
@@ -28,11 +28,8 @@ func RunServer(addr string, queries *event.Queries) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:embed static/*
|
|
||||||
var staticFiles embed.FS
|
|
||||||
|
|
||||||
func StaticHandler(prefix string) (http.Handler, error) {
|
func StaticHandler(prefix string) (http.Handler, error) {
|
||||||
static, err := fs.Sub(staticFiles, "static")
|
static, err := fs.Sub(staticfiles, "static")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user