Explorar el Código

first simple http server is up and running

master
sp hace 4 años
padre
commit
43207aaada
Se han modificado 1 ficheros con 18 adiciones y 0 borrados
  1. +18
    -0
      main.go

+ 18
- 0
main.go Ver fichero

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")
}

Cargando…
Cancelar
Guardar