View Source FlEx.Server (fl_ex v0.1.2)

The server module it's the main piece of the server, can be the only router or just a router forwarder, in all cases it's the init of all

Example:

defmodule MyApp.Server do
  use FlEx.Server, otp_app: :my_app

  plug Plug.Head
  plug Plug.RequestId

  # define directly your route
  get "/your_page/:param", :my_func

  def my_func(conn, %{"param" => param} = _params) do
    conn
    |> FlEx.Renderer.status(200)
    |> FlEx.Renderer.json(%{some_key: "your param", param: param})
  end
end

Summary

Functions

Define a router module to forward all the request in case tha some request matches with the route

Functions

Link to this macro

define_router(mod)

View Source (macro)

Define a router module to forward all the request in case tha some request matches with the route

Example:

define_router MyApp.SomeRouter