class LavinMQ::HTTP::ViewsController
- LavinMQ::HTTP::ViewsController
- Reference
- Object
Included Modules
Defined in:
lavinmq/http/controller/views.crConstant Summary
-
ETag =
"W/\"1732599463\""
-
Log =
LavinMQ::Log.for("http.views")
Constructors
Macro Summary
- active_path?(path)
-
render(file)
Render an ecr file from views dir
-
static_view(path, view = nil, &block)
Generate a get handler for given path.
Instance methods inherited from module LavinMQ::HTTP::Router
call(context)
call,
delete(path : String, &block : Action)
delete,
find_route(method, path)
find_route,
get(path : String, &block : Action)
get,
head(path : String, &block : Action)
head,
options(path : String, &block : Action)
options,
patch(path : String, &block : Action)
patch,
post(path : String, &block : Action)
post,
put(path : String, &block : Action)
put
Constructor Detail
Macro Detail
macro static_view(path, view = nil, &block)
#
Generate a get handler for given path. If no view is specified, path without initial slash will be used as view.
Optional block can be given to modify context or set variables before view is rendered.
This would render views/json_data.ecr and change content type:
static_view "/json", "json_data" do
context.response.content_type = "application/json"
end