<commit_before>defmodule Api.Router do
  use Plug.Router

  plug(:match)
  plug(:dispatch)

  get "/" do
    data = Mongo.find(:mongo, "organizations", %{}, limit: 5, pool: DBConnection.Poolboy)
      |> Enum.to_list
      |> Poison.encode!

    send_resp(conn, 200, data)
  end

  match(_, do: send_resp(conn, 404, "Oops!"))
end<commit_msg>#master. impl to json method<commit_after>defmodule Api.Router do
  use Plug.Router

  defp json(data) do
    data
      |> Enum.to_list
      |> Poison.encode!
  end

  plug(:match)
  plug(:dispatch)

  get "/" do
    data = Mongo.find(:mongo, "organizations", %{}, limit: 5, pool: DBConnection.Poolboy)
      |> json

    send_resp(conn, 200, data)
  end


  match(_, do: send_resp(conn, 404, "Oops!"))
end
{'fraction_non_alphanumeric': 0.14953271028037382, 'fraction_numerical': 0.018691588785046728, 'mean_word_length': 3.189944134078212, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7430326', 'n_tokens_mistral': 299, 'n_tokens_neox': 267, 'n_words': 65}