Responses

Returning data to the client in various formats.


JSON Responses

Send JSON responses with the appropriate headers automatically.

c.JSON(200, map[string]interface{}{
    "status": "success",
    "data":   data,
})

Redirects

Redirect the user to a different URL.

c.Redirect(302, "/login")

HTML Handling

Render raw HTML or templates.

c.HTML(200, "<h1>Hello World</h1>")