RevisionPlateEx v0.1.0 RevisionPlateEx.Hello
Define RevisionPlateEx Hello.
This module defines functions to generate %Plug.Conn{}
which have revision plate. To use this feature, you should set as the following example.
Example with <code class="inline">Plug</code>
defmodule MyApp.Hello do
import Plug.Conn
def sample_revision(conn), do: RevisionPlateEx.Hello.revision conn
end
Then MyApp.Hello.sample_revision/1
return 200
as status code and binary read from REVISION
file which exists on root path as default. Return 404
and not found message if REVISION
file doesn’t exist.
Summary
Functions
This function can use with Phoenix like the following. In this case, when anyone access to /hello/revision
with GET
method, then return revision with 200
statuscode or not found message with 404
Types
conn :: %Plug.Conn{adapter: term, assigns: term, before_send: term, body_params: term, cookies: term, halted: term, host: term, method: term, owner: term, params: term, path_info: term, peer: term, port: term, private: term, query_params: term, query_string: term, remote_ip: term, req_cookies: term, req_headers: term, request_path: term, resp_body: term, resp_cookies: term, resp_headers: term, scheme: term, script_name: term, secret_key_base: term, state: term, status: term}
Functions
This function can use with Phoenix like the following. In this case, when anyone access to /hello/revision
with GET
method, then return revision with 200
statuscode or not found message with 404
.
Example in web/router.ex
defmodule MyApp.Router do
use MyApp.Web, :router
...
scope "/", MyApp do
get "/hello/revision", HelloController, :revision
end
end
Example in web/controllers/hello_controller.ex
defmodule MyApp.Hello do
use MyApp.Web, :controller
def revision(conn, _opt), do: RevisionPlateEx.Hello.revision conn
end