Iris MVC
Logo 由 Santosh Anand 设计。
源代码:
- package main
- import (
- "github.com/kataras/iris"
- "github.com/kataras/iris/_benchmarks/iris-mvc/controllers"
- )
- func main() {
- app := iris.New()
- app.Controller("/api/values/{id}", new(controllers.ValuesController))
- app.Run(iris.Addr(":5000"), iris.WithoutVersionChecker)
- }
- package controllers
- import "github.com/kataras/iris/mvc"
- // ValuesController is the equivalent
- // `ValuesController` of the .net core 2.0 mvc application.
- type ValuesController struct {
- mvc.Controller
- }
- // Get handles "GET" requests to "api/values/{id}".
- func (vc *ValuesController) Get() {
- // id,_ := vc.Params.GetInt("id")
- vc.Ctx.WriteString("value")
- }
- // Put handles "PUT" requests to "api/values/{id}".
- func (vc *ValuesController) Put() {}
- // Delete handles "DELETE" requests to "api/values/{id}".
- func (vc *ValuesController) Delete() {}
- package main
- import (
- "github.com/kataras/iris/_benchmarks/iris-mvc-templates/controllers"
- "github.com/kataras/iris"
- "github.com/kataras/iris/context"
- )
- const (
- // templatesDir is the exactly the same path that .NET Core is using for its templates,
- // in order to reduce the size
推荐阅读
SQL Server 2017正式发布;Oracle宣布开源Fn project
SQL Server 2017 正式宣布:同时支撑 Windows 和 Linux微软在客岁 3 月初次对外宣布了 Linux 版的 SQL Server,痊愈本年 7 月宣布了首个公开 RC 版。前几日在美国奥兰多召开的微软 Ignit>>>详细阅读
地址:http://www.17bianji.com/lsqh/37756.html
1/2 1

网友点评
精彩导读
科技快报
品牌展示