gotodo/main.go

21 lines
563 B
Go

package main
import (
"fmt"
"log"
"net/http"
)
import "snamellit.com/play/todo/internal/webserver"
func main() {
fmt.Println("Starting web server on port 8080")
fs := http.FileServer(http.Dir("./static"))
http.Handle("/static/", http.StripPrefix("/static/", fs))
http.HandleFunc("/", webserver.IndexHandler)
http.HandleFunc("/todos", webserver.TodosHandler)
webserver.PathHandleFunc("/toggle-todo/", webserver.ToggleTodoHandler)
webserver.PathHandleFunc("/todo/", webserver.TodoHandler)
log.Fatal(http.ListenAndServe(":8080", nil))
}