I am working on a Lumen + Laravel application wherein Lumen is my RESTful API while my Laravel is the web app itself.
Laravel 5.2.0
Lumen 5.1.6
I have installed guzzlehttp on my Laravel web app for API requests (get, post, delete, put). Whenever I do a GET request, I get a Server error: 'GET http://example.local/api/blog' resulted in a '500 Internal Server Error' response:
when retrieving from my Lumen API. But when I do a request thru PostMan, I am able to retrieve data successfully even when I input http://example.local/api/blog
directly on the browser, I get the json response.
Lumen GET:
public function getBlogs()
{
return response()->json($this->sqlConnection()->table(self::TABLE_NAME)->get(), 200);
}
Laravel:
public function index(Client $client)
{
return $client->get('http://example.local/api/blog')->getBody();
}
I do have other RESTful APIs build with a different framework and tried to test it out if my Laravel web app could connect and it was able to. I find it weird because connecting thru my Lumen API always return a 500 internal server error.