package main import ( "context" pb "github.com/kataras/iris/v12/_examples/mvc/grpc-compatible/helloworld" "github.com/kataras/iris/v12" "github.com/kataras/iris/v12/mvc" "google.golang.org/grpc" ) // See https://github.com/kataras/iris/issues/1449 // Iris automatically binds the standard "context" context.Context to `iris.Context.Request().Context()` // and any other structure that is not mapping to a registered dependency // as a payload depends on the request, e.g XML, YAML, Query, Form, JSON. // // Useful to use gRPC services as Iris controllers fast and without wrappers. func main() { app := newApp() app.Logger().SetLevel("debug") // The Iris server should ran under TLS (it's a gRPC requirement). // POST: https://localhost:443/helloworld.Greeter/SayHello // with request data: {"name": "John"} // and expected output: {"message": "Hello John"} app.Run(iris.TLS(":443", "server.crt", "server.key")) } func newApp() *iris.Application { app := iris.New() // app.Configure(iris.WithLowercaseRouting) // OPTIONAL. app.Get("/", func(ctx iris.Context) { ctx.HTML("