module Orion::Controller::JSONHelpers

Overview

JSON Response Helpers Simplified JSON rendering

Usage: get "/api/users" do json({users: all_users}) end

Direct including types

Defined in:

orion/controller/json_helpers.cr

Instance Method Summary

Instance Method Detail

def json(data, status : Int32 = 200) #

Render JSON response


def json_accepted(data) #

def json_bad_request(data) #

def json_created(data, location : String | Nil = nil) #

def json_forbidden(data) #

def json_internal_server_error(data) #

def json_not_found(data) #

def json_ok(data) #

Render JSON with specific status


def json_unauthorized(data) #

def json_unprocessable_entity(data) #

def jsonp(data, callback : String = "callback", status : Int32 = 200) #

Render JSONP response