show json response with error under /api instead redirecting to error page/main page
Merge pull request #295 from ahilles107/fix_api_error_response

Fix api error response