Packages

Lightweight and easy to use API micro-framework.

Current section

Files

Jump to
fl_ex lib fl_ex plug api_rest_json.ex
Raw

lib/fl_ex/plug/api_rest_json.ex

defmodule FlEx.Plug.ApiRestJson do
@moduledoc """
All the required to have an json api rest
includes a body parser (json, multipart and form post), method override to use put/patch/delete and other http methods
"""
use Plug.Builder
plug Plug.Parsers,
parsers: [:urlencoded, :multipart, :json],
pass: ["*/*"],
json_decoder: Jason
plug Plug.MethodOverride
def init(opts), do: opts
def call(conn, opts) do
super(conn, opts)
end
end