27 lines
633 B
Go
27 lines
633 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
|
|
"github.com/a-h/templ"
|
|
"sunshine.industries/temp-exercise/templates"
|
|
)
|
|
|
|
func main() {
|
|
component := templates.IndexPage(templates.PageData{
|
|
Balance: 1021.12,
|
|
Expenses: []float32{37.45, 34.91, 37.36, 31.07, 7.39, 43.28, 25.48},
|
|
TotalThisMonth: 612.41,
|
|
PercentComparedToLastMonth: 3.1,
|
|
})
|
|
|
|
http.Handle("/", templ.Handler(component))
|
|
|
|
staticFs := http.FileServer(http.Dir("./static"))
|
|
http.Handle("/static/", http.StripPrefix("/static/", staticFs))
|
|
|
|
fmt.Println("starting to serve on :3000")
|
|
http.ListenAndServe(":3000", nil)
|
|
}
|