Go常用库

flag

package main

import (
	"flag"
	"github.com/kataras/iris/v12"
)

// 需要配合 flag.Parse() 使用
var port = flag.String("port", "8080", "The address to listen on for HTTP requests.")

func main() {
	flag.Parse()
	app := iris.New()
	app.Get("/", index)
	app.Listen(":" + *port)
}

func index(ctx iris.Context) {
	ctx.HTML("<h1>Hello, World!</h1>")
}

posted @ 2020-07-21 15:03  飞_2016  阅读(144)  评论(0编辑  收藏  举报