craftcms / element-api

Create a JSON API/Feed for your elements in Craft.
MIT License
498 stars 57 forks source link

Control Panel is rendered in plain HTML after activating Element API #110

Closed marcwieland95 closed 5 years ago

marcwieland95 commented 5 years ago

Hey,

I'm not sure if this problem just occurs for me or if anyone else also came along this issue.

I just installed a fresh Craft CMS instance, which means it's up to date. Then I installed the plugin to generate JSON endpoints. After composer finishes the install of the Element API plugin my control panel is gone and the plain HTML is outputted on the screen. Which is very strange.

Does anyone have the same issue or know how to solve it?

Thanks and cheers Marc

brandonkelly commented 5 years ago

Guessing you have a syntax error in config/element-api.php. Try clearing out your storage/logs/ folder, then refreshing the CP, and see if anything gets logged (likely in phperrors.log).

marcwieland95 commented 5 years ago

I'll try that out.

Funny thing is that the endpoint itself is working

marcwieland95 commented 5 years ago

Indeed, I had something inside which seemed to break everything. Not a syntax error but a Craft helper function which broke somehow.

Craft::$app->getResponse()->getHeaders()->set('Content-Type', 'Access-Control-Allow-Headers');