Handler

Handler #

Functions handle incoming request and outcoming response

func ExampleHandler() Handler {
	return func(c hiro.Ctx) error {
	    return c.Response().Text("Hello World!")	
    } 
}

Advice

  • Through handler factory, you can pass deps as args
func ExampleHandler(exampleService example_service.ExampleService) Handler {
    return func(c hiro.Ctx) error {
        return c.Response().Text(exampleService.GetResult())
    } 
}

Next step #

Route