/** * Returns JavaScript API * * @param Application $app * * @return \Symfony\Component\HttpFoundation\Response */ public function apiAction(Application $app) { $path = $app->path('search', array('code' => null, 'format' => null)); $file = str_replace('%URL%', $path, $app['api.js']); return new Response($file, 200, array('Content-Type' => 'text/javascript')); }