Wobserver v0.1.7 Wobserver.Web.Router.Helper

Helper methods for routers.

Summary

Functions

Sends a JSON encoded response back to the client

Functions

send_json_resp(data, conn)
send_json_resp(data :: atom | String.t | map | list, conn :: Plug.Conn.t) :: Plug.Conn.t

Sends a JSON encoded response back to the client.

The https status will be 200 or 500 if the given data can not be JSON encoded.

The conn content type is set to application/json, only if the data could be encoded.