register(new ServiceControllerServiceProvider()); $app->register(new AssetServiceProvider()); $app->register(new TwigServiceProvider()); $app->register(new HttpFragmentServiceProvider()); $app->register(new HttpFragmentServiceProvider()); //$app['twig'] = $app->extend('twig', function ($twig, $app) { // return $twig; //}); // se muestra el readme. $app->get('/docs', function () { $file = file_get_contents("./docs/READMEv1.md"); $Parsedown = new Parsedown(); return $Parsedown->text($file); }); // captura todos los options y responde con un 200 para que despues haga la peticion correcta. $app->options("/{anything}", function () { return new Response("", 200); })->assert("anything", ".*"); // escribo el encabezado para evitar el cors $app->after(function (Request $req, Response $resp) { $resp->headers->set('Access-Control-Allow-Credentials', 'true'); $resp->headers->set('Access-Control-Allow-Headers', 'Origin, Content-Type, Accept, Authorization'); $resp->headers->set('Access-Control-Allow-Origin', '*'); $resp->headers->set('Access-Control-Allow-Methods', 'POST, GET, PUT, DELETE, PATCH, OPTIONS'); }); $base = new \Swagger\Client\Base\Services(); $base->getTenancyId($app); $base->getTenancies($app); $base->getClientId($app); $base->getClients($app); $base->postClient($app); $base->putClient($app); $base->deleteClient($app); $base->getClientActive($app); $base->getClientDisable($app); $ftth = new \Swagger\Client\FTTH\Services(); $ftth->getNAPId($app); $ftth->getNAPs($app); $ftth->getOLTId($app); $ftth->getOLTs($app); $ftth->getONUModelId($app); $ftth->getONUModels($app); $ftth->getOLTModelId($app); $ftth->getOLTModels($app); $ftth->getONUProfileId($app); $ftth->getONUProfiles($app); $ftth->getVLanProfileId($app); $ftth->getVLanProfiles($app); $ftth->getONUTemplateId($app); $ftth->getONUTemplates($app); $ftth->getTContProfileId($app); $ftth->getTContProfiles($app); $ftth->getTrafficProfileId($app); $ftth->getTrafficProfiles($app); $ftth->getVLanIDId($app); $ftth->getVLanIDs($app); $ftth->getProfileId($app); $ftth->getProfiles($app); $ftth->getONUId($app); $ftth->getONUs($app); $ftth->postONU($app); $ftth->putONU($app); $ftth->deleteONU($app); $ftth->getONUActive($app); $ftth->getONUSuspend($app); $ftth->getONUEnable($app); $ftth->getONUDisable($app); $ftth->getONUSupply($app); $cablemodem = new \Swagger\Client\Cablemodem\Services(); $cablemodem->getNodeId($app); $cablemodem->getNodes($app); $cablemodem->getModelId($app); $cablemodem->getModels($app); $cablemodem->getProfileId($app); $cablemodem->getProfiles($app); $cablemodem->getCablemodemId($app); $cablemodem->getCablemodems($app); $cablemodem->postCablemodem($app); $cablemodem->putCablemodem($app); $cablemodem->deleteCablemodem($app); $cablemodem->getCablemodemActive($app); $cablemodem->getCablemodemDisable($app); $cablemodem->getCablemodemSupply($app); $radius = new \Swagger\Client\Radius\Services(); $radius->getProfileId($app); $radius->getProfiles($app); $radius->getAccessId($app); $radius->getAccesses($app); $radius->postAccess($app); $radius->putAccess($app); $radius->deleteAccess($app); $app->flush(); return $app; ?>