View Source Spaceboy.Controller (Spaceboy v0.3.2)
Controllers group common functionality and are pointed to by routers.
Spaceboy controllers are very similar to Phoenix ones, but unlike Phoenix there is no concept of a separate "view" module.
Controllers are related to Connections, and any module that use
s this one
automatically imports Spaceboy.Conn
.
Options
:root
the directory containing templates that can be used withrender
. Defaults tolib/templates/
, same as Phoenix. It is always relative to your application root folder.
Summary
Functions
Set client certificate required response
Set text/gemini string as response
Set input response
Set map as JSON response
Set not found response
Set redirect response
Set response as rendered template
Set text/plain string as response
Functions
@spec auth_required(conn :: Spaceboy.Conn.t(), prompt :: String.t()) :: Spaceboy.Conn.t()
Set client certificate required response
@spec gemini(conn :: Spaceboy.Conn.t(), content :: String.t()) :: Spaceboy.Conn.t()
Set text/gemini string as response
@spec input(conn :: Spaceboy.Conn.t(), prompt :: String.t()) :: Spaceboy.Conn.t()
Set input response
@spec json(conn :: Spaceboy.Conn.t(), content :: map()) :: Spaceboy.Conn.t()
Set map as JSON response
@spec not_found(conn :: Spaceboy.Conn.t(), prompt :: String.t()) :: Spaceboy.Conn.t()
Set not found response
@spec redirect(conn :: Spaceboy.Conn.t(), path :: String.t()) :: Spaceboy.Conn.t()
Set redirect response
@spec render( conn :: Spaceboy.Conn.t(), template :: Path.t(), mime :: String.t() | nil ) :: Spaceboy.Conn.t()
Set response as rendered template
@spec text(conn :: Spaceboy.Conn.t(), content :: String.t()) :: Spaceboy.Conn.t()
Set text/plain string as response