paint-brush
Always return JSON with Laravel APIby@deleugpn
16,086 reads
16,086 reads

Always return JSON with Laravel API

by Marco Aurélio Deleu1mApril 8th, 2018
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

I’ve recently started working on some small projects that will only use the backend portion of Laravel. One of the first things we bump into is the Authentication Exception that tries to redirect to <code class="markup--code markup--p-code">/home</code> or <code class="markup--code markup--p-code">/login</code>. That redirection becomes another exception: <code class="markup--code markup--p-code">InvalidArgumentException: Route [login] is not defined.</code>. Here is an extreme simple solution for when you only want to work with API Responses.

Company Mentioned

Mention Thumbnail
featured image - Always return JSON with Laravel API
Marco Aurélio Deleu HackerNoon profile picture
Marco Aurélio Deleu

Marco Aurélio Deleu

@deleugpn

L O A D I N G
. . . comments & more!

About Author

Marco Aurélio Deleu HackerNoon profile picture
Marco Aurélio Deleu@deleugpn

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite