Skip to content

Instantly share code, notes, and snippets.

@santosh79
Last active January 10, 2016 07:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save santosh79/1cddd944dd06ee760848 to your computer and use it in GitHub Desktop.
Save santosh79/1cddd944dd06ee760848 to your computer and use it in GitHub Desktop.
def call(conn, _opts) do
:random.seed :erlang.monotonic_time()
rand_number = (:random.uniform * 100) |> Float.round(2)
{:ok, rand_json} = [rand_number: rand_number] |> JSON.encode
conn
|> put_resp_content_type("application/json")
|> send_resp(200, rand_json)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment