You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
458 B
28 lines
458 B
package main |
|
|
|
import ( |
|
"embed" |
|
"log" |
|
"net/http" |
|
) |
|
|
|
//go:embed static |
|
var staticFiles embed.FS |
|
|
|
type Guestbook struct { |
|
Comments []string |
|
Count int |
|
} |
|
|
|
func main() { |
|
app := App{store: TxtStore("comments.txt")} |
|
|
|
http.HandleFunc("/", app.mainPageHandler) |
|
http.HandleFunc("/new", app.newCommentHandler) |
|
|
|
var staticFS = http.FS(staticFiles) |
|
http.Handle("/static/", http.FileServer(staticFS)) |
|
|
|
err := http.ListenAndServe(":80", nil) |
|
log.Fatal(err) |
|
}
|
|
|