iris RESTful API

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

(0)
打赏 支付宝 支付宝 微信 微信
冒牌SEO冒牌SEO
上一篇 2023年5月19日
下一篇 2023年5月19日

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注