Files
gogmagog/main.go
2020-12-24 21:35:38 -06:00

30 lines
585 B
Go

package main
import (
"log"
"net/http"
)
func main() {
PORT := ":8080"
log.Print("Running server on " + PORT)
http.Handle("/static/", http.FileServer(http.Dir("public")))
http.HandleFunc("/complete/", ShowCompleteActions)
http.HandleFunc("/actions/", GetAction)
log.Fatal(http.ListenAndServe(PORT, nil))
}
func ShowCompleteActions(w http.ResponseWriter, r *http.Request) {
w.Write([]byte(r.URL.Path))
}
func GetAction(w http.ResponseWriter, r *http.Request) {
if r.Method == "GET" {
id := r.URL.Path[len("/actions/"):]
w.Write([]byte("Get the action " + id))
}
}