mirror of
https://gitee.com/johng/gf
synced 2026-07-06 13:42:46 +08:00
22 lines
375 B
Go
22 lines
375 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/gogf/gf/v2/frame/g"
|
|
"github.com/gogf/gf/v2/net/ghttp"
|
|
)
|
|
|
|
func main() {
|
|
s := g.Server()
|
|
s.BindMiddlewareDefault(func(r *ghttp.Request) {
|
|
fmt.Println("cors")
|
|
r.Response.CORSDefault()
|
|
r.Middleware.Next()
|
|
})
|
|
s.BindHandler("/api/captcha", func(r *ghttp.Request) {
|
|
r.Response.Write("captcha")
|
|
})
|
|
s.SetPort(8010)
|
|
s.Run()
|
|
}
|