26 lines
484 B
Go
26 lines
484 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"net/http"
|
|
|
|
"github.com/a-h/templ"
|
|
)
|
|
|
|
func main() {
|
|
mux := http.NewServeMux()
|
|
|
|
// Serve the templ page.
|
|
mux.Handle("/", templ.Handler(page()))
|
|
|
|
// Serve static content.
|
|
mux.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static"))))
|
|
|
|
// Start the server.
|
|
fmt.Println("listening on localhost:8080")
|
|
if err := http.ListenAndServe("localhost:8080", mux); err != nil {
|
|
log.Printf("error listening: %v", err)
|
|
}
|
|
}
|