ソースを参照

first simple http server is up and running

master
sp 4年前
コミット
43207aaada
1個のファイルの変更18行の追加0行の削除
  1. +18
    -0
      main.go

+ 18
- 0
main.go ファイルの表示

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

読み込み中…
キャンセル
保存