gogmagog/main.go
Deepak 914de124b3
Some checks failed
gitea-deepak/gogmagog/pipeline/head There was a failure building this commit
adds test satisfier
2020-12-24 22:21:47 -06:00

33 lines
635 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))
}
}
func Hello() string {
return "Hello, world!\n"
}