| 12345678910111213141516171819202122232425 |
- package main
- import (
- "net/http"
- "log"
- "fmt"
- )
- func main() {
- http.HandleFunc("/api/greeting", greetingHandler)
- http.Handle("/", http.FileServer(http.Dir("resources")))
- log.Println("Listening on https://localhost:8443")
- err := http.ListenAndServeTLS(":8443", "certs/localhost.cert", "certs/localhost.key", nil)
- log.Fatal(err)
- }
- func greetingHandler(w http.ResponseWriter, r *http.Request) {
- w.Header().Set("Content-Type", "text/plain; charset=utf8")
- _, err := fmt.Fprint(w, "Hallo Quintor!")
- if err != nil {
- log.Println(err)
- }
- }
|