Responses
NoteIMPORTANT!
The response file should be placed in directoryapp/http/response
How to response string
, HTML
, JSON
, download
data
// Simple
return errors.NotImplemented
// Structure JSON
return c.Error(response.Error{
Code: core.StatusUnauthorized,
Message: "Invalid JWT token",
}, core.StatusUnauthorized)
// String
return c.String("Hello world")
// HTML
return c.HTML("<h2>Hello world</h2>")
return c.Status(gfly.StatusOK).JSON(response.SignIn{
Access: tokens.Access,
Refresh: tokens.Refresh,
})
return c.Download("./storage/logs/logs.log", "Log_file.log")
func (m *UploadFormPage) Handle(c *gfly.Ctx) error {
return c.View("upload", gfly.ViewData{})
}
View template resources/views/upload.tpl