Some checks failed
gitea-deepak/gogmagog/pipeline/head There was a failure building this commit
33 lines
635 B
Go
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"
|
|
} |