Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

afoysal's avatar

API Development

I am trying to develop an API using Laravel. My code is like below

Route::get('/abcd', function() {
    return response()->json(['name' => 'Abigail', 'state' => 'CA']);
});

enter image description here

But I am getting no output in POSTMAN.

enter image description here

0 likes
7 replies
ChristophHarms's avatar

I can't see anything wrong here. But since you get a 500 error, that means that PHP probably exits with a fatal somewhere. You'll have to debug your request and see what that 500 actually is.

2 likes
Kinomej's avatar

Those errors are also thrown if you don't have the correct file permissions set.

From the laravel documentation:

Directory Permissions
After installing Laravel, you may need to configure some permissions. Directories within the  storage and the bootstrap/cache directories should be writable by your web server or Laravel will not run. If you are using the Homestead virtual machine, these permissions should already be set.

https://laravel.com/docs/5.8/installation

Also the Application key must be set.

mushood's avatar

@afoysal Is your app loading in the browser at least? If it is not, then the problem is with your installation on the server.

Did you try this in local development to see if you have the same error 500?

Please or to participate in this conversation.