 defmodule Trot.Router do
   alias Plug.Conn.Status
+  require Logger
 
   @doc false
   defmacro __using__(_opts) do

  def make_response(body, conn) do
    body = Poison.encode!(body)
    Plug.Conn.send_resp(conn, Status.code(:ok), body)
  end

  defmacro get(path, options \\ [], do: body), do: compile(:get, path, options, body)

    raise ArgumentError, message: "conn must be sent before being returned"
  end
  def make_response(conn = %Plug.Conn{}, _conn), do: conn
  def make_response({:redirect, to}, conn), do: redirect(to, conn)
  def make_response(code, conn) when is_number(code) do
    Plug.Conn.send_resp(conn, code, "")
  end
