mirror of
https://gitee.com/johng/gf.git
synced 2024-12-01 11:48:09 +08:00
20 lines
384 B
Go
20 lines
384 B
Go
package main
|
|
|
|
import "github.com/gogf/gf/net/ghttp"
|
|
|
|
func Hello1(r *ghttp.Request) {
|
|
r.Response.Write("127.0.0.1: Hello World1!")
|
|
}
|
|
|
|
func Hello2(r *ghttp.Request) {
|
|
r.Response.Write("localhost: Hello World2!")
|
|
}
|
|
|
|
func main() {
|
|
s := ghttp.GetServer()
|
|
s.Domain("127.0.0.1").BindHandler("/", Hello1)
|
|
s.Domain("localhost, local").BindHandler("/", Hello2)
|
|
s.SetPort(8199)
|
|
s.Run()
|
|
}
|