iris同样支持RESTful API,具体使用方法如下
package main
import "github.com/kataras/iris/v12"
func main() {
app := iris.Default()
//需自行添加对应函数
app.Get("/someGet", getting)
//func getting(ctx iris.Context){...}
app.Post("/somePost", posting)
//func posting(ctx iris.Context){...}
app.Put("/somePut", putting)
//func putting(ctx iris.Context){...}
app.Delete("/someDelete", deleting)
//func deleting(ctx iris.Context){...}
app.Patch("/somePatch", patching)
//func patching(ctx iris.Context){...}
app.Header("/someHead", head)
//func head(ctx iris.Context){...}
app.Options("/someOptions", options)
//func options(ctx iris.Context){...}
app.Listen(":8080")
}
作者:冒牌SEO,如若转载,请注明出处:https://www.web176.com/iris/21996.html