mount('/UserPreferences/', new UserPreferences()); $app->mount('/query/', new Query()); $app->mount('/order/', new Order()); $app->mount('/baskets', new Basket()); $app->mount('/story', new Story()); $app->mount('/WorkZone', new WorkZone()); $app->mount('/lists', new UsrLists()); $app->mount('/MustacheLoader', new MustacheLoader()); $app->mount('/records/edit', new Edit()); $app->mount('/records/movecollection', new MoveCollection()); $app->mount('/bridge/', new Bridge()); $app->mount('/push/', new Push()); $app->mount('/printer/', new Printer()); $app->mount('/TOU/', new TOU()); $app->mount('/feeds', new Feed()); $app->mount('/tooltip', new Tooltip()); $app->mount('/language', new Language()); $app->mount('/tools/', new Tools()); $app->mount('/lazaret/', new Lazaret()); $app->mount('/upload/', new Upload()); $app->mount('/', new Root()); $app->error(function (\Exception $e, $code) use ($app) { /* @var $request \Symfony\Component\HttpFoundation\Request */ $request = $app['request']; if ($request->getRequestFormat() == 'json') { $datas = array( 'success' => false , 'message' => $e->getMessage() ); return $app->json($datas, 200, array('X-Status-Code' => 200)); } if ($e instanceof \Exception_BadRequest) { return new Response('Bad Request', 400, array('X-Status-Code' => 400)); } if ($e instanceof \Exception_NotFound) { return new Response('Not Found', 404, array('X-Status-Code' => 404)); } if ($e instanceof \Exception_Forbidden) { return new Response('Not Found', 403, array('X-Status-Code' => 403)); } }); return $app; } );