Packages

An example of a simple HTTP server built from scratch with Elixir.

Current section

Files

Jump to
atparkweb_servo lib servo views bot_view.ex
Raw

lib/servo/views/bot_view.ex

defmodule Servo.Views.BotView do
require EEx
@templates_path Path.expand("../../../templates", __DIR__)
EEx.function_from_file :def, :index, Path.join(@templates_path, "index.eex"), [:bots]
EEx.function_from_file :def, :show, Path.join(@templates_path, "show.eex"), [:bot]
# defp render(req, template, bindings \\ []) do
# content =
# @templates_path
# |> Path.join(template)
# |> EEx.eval_file(bindings)
# %Request{ req | status: 200, res_body: content }
# end
end