1月15日開催!現年収非公開で企業からスカウトをもらってみませんか?PR

転職ドラフトでリアルな市場価値を測る。レジュメをもとに、企業から年収とミッションが提示されます。

6
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Go (その3)Advent Calendar 2016

Day 10

goでWebアプリケーションをつくった話

Posted at

単純なHTTPのコード

main.go

package main

import (
	"log"
	"net/http"
)

func main() {

	http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request ) {
         w.Write([]byte(`
         <html><head><title>ちゃっと</title></head>
         <body>ちゃっと</body>
         </html>
         `))
	})

	if err := http.ListenAndServe(":8080" , nil); err != nil {
	    log.Fatal("ListenAndServe:" , err)
	}
}

実行する方法

$ go run main.go
6
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?