LoginSignup
4
6

More than 5 years have passed since last update.

Go irisで速攻Webアプリ

Posted at

ゴール

Goのweb framework irisでwebアプリを起動する。

やりかた

1. Goのインストール

インストーラ: https://golang.org/dl/

2. irisでサーバ起動

以下コピペ

# irisを入手
go get -u github.com/kataras/iris

# プログラムを配置
cat << EOF > main.go
package main

import "github.com/kataras/iris"

func main() {
    app := iris.Default()

    app.Handle("GET", "/", func(ctx iris.Context) {
        ctx.HTML("Hello Go world!\n")
    })

    app.Run(iris.Addr(":10080"))
}
EOF

# 起動
go run main.go &

# テスト
curl http://localhost:10080/

Link

Go lang
iris

4
6
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
4
6