Sfoglia il codice sorgente

first simple http server is up and running

master
sp 4 anni fa
parent
commit
43207aaada
1 ha cambiato i file con 18 aggiunte e 0 eliminazioni
  1. +18
    -0
      main.go

+ 18
- 0
main.go Vedi File

@@ -0,0 +1,18 @@
package main

import (
"fmt"
"log"
"net/http"
)

func main() {

http.HandleFunc("/", HelloHandler)
fmt.Println("Server started at port 8080")
log.Fatal(http.ListenAndServe(":8080", nil))
}

func HelloHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello, there\n")
}

Loading…
Annulla
Salva