Right now I'm getting nice error messages from my Phoenix server:

However, I'm using Phoenix as an API, and these error messages show up as a large chunk of unreadable html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>UndefinedFunctionError at GET /api/v1/sessions/test</title>
<meta name="viewport" content="width=device-width">
<style>/*! normalize.css v4.2.0 | MIT License | github.com/necolas/normalize.css */html{font
...1300+ lines...
Is there a way to turn this off so my development server spits out JSON error messages instead? Thanks.
In your config/dev.exs in the web endpoint configuration main section set debug_errors value to false:
config :my_app, MyAppWeb.Endpoint,
# http: [port: 4000], # or like
debug_errors: false, # ⇐ HERE
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With