cpolis/main.go

27 lines
779 B
Go
Raw Normal View History

2024-02-18 07:20:51 +01:00
package main
import (
"html/template"
"log"
"net/http"
2024-02-18 12:41:49 +01:00
"streifling.com/jason/cpolis/cmd/feed"
"streifling.com/jason/cpolis/cmd/handlers"
)
2024-02-18 07:20:51 +01:00
func main() {
mux := http.NewServeMux()
2024-02-18 12:41:49 +01:00
feed := feed.NewFeed("Freimaurer Distrikt Niedersachsen und Sachsen-Anhalt",
"https://distrikt-ni-st.de",
"Freiheit, Gleichheit, Brüderlichkeit, Toleranz und Humanität")
mux.Handle("/web/static/", http.StripPrefix("/web/static/", http.FileServer(http.Dir("web/static/"))))
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
template.Must(template.ParseFiles("web/templates/index.html", "web/templates/editor.html")).Execute(w, nil)
})
2024-02-18 12:41:49 +01:00
mux.HandleFunc("POST /finished-edit/", handlers.HandleFinishedEdit(feed))
log.Fatalln(http.ListenAndServe(":8080", mux))
2024-02-18 07:20:51 +01:00
}