예제 #1
0
파일: Raids.php 프로젝트: mroswald/invme
 public function register(App &$app)
 {
     $self = $this;
     $app->post('/raids', function (Request $request, Response $response) use(&$self) {
         return $self->responseRaids($request, $response)->withHeader('Access-Control-Allow-Origin', '*')->withHeader('Content-type', 'application/json');
     });
     $app->options('/raids', function (Request $request, Response $response, $args) use(&$self) {
         return $response->withHeader('Access-Control-Allow-Origin', '*')->withHeader('Access-Control-Allow-Headers', 'Content-Type, X-AUTH-USER, X-AUTH-TOKEN');
     });
     $app->post('/raids/add', function (Request $request, Response $response) use(&$self) {
         return $self->responseRaidsAdd($request, $response)->withHeader('Access-Control-Allow-Origin', '*')->withHeader('Content-type', 'application/json');
     });
     $app->options('/raids/add', function (Request $request, Response $response, $args) use(&$self) {
         return $response->withHeader('Access-Control-Allow-Origin', '*')->withHeader('Access-Control-Allow-Headers', 'Content-Type, X-AUTH-USER, X-AUTH-TOKEN');
     });
 }
예제 #2
0
파일: Login.php 프로젝트: mroswald/invme
 public function register(App &$app)
 {
     $self = $this;
     $app->post('/login', function (Request $request, Response $response) use(&$self) {
         return $self->responseLogin($request, $response)->withHeader('Content-type', 'application/json')->withHeader('Access-Control-Allow-Origin', '*');
     });
     $app->options('/login', function (Request $request, Response $response, $args) use(&$self) {
         return $response->withHeader('Access-Control-Allow-Origin', '*')->withHeader('Access-Control-Allow-Headers', 'Content-Type');
     });
     $app->post('/login/check', function (Request $request, Response $response) use(&$self) {
         return $self->responseLoginCheck($request, $response)->withHeader('Content-type', 'application/json')->withHeader('Access-Control-Allow-Origin', '*');
     });
     $app->options('/login/check', function (Request $request, Response $response, $args) use(&$self) {
         return $response->withHeader('Access-Control-Allow-Origin', '*')->withHeader('Access-Control-Allow-Headers', 'Content-Type');
     });
 }
예제 #3
0
파일: Version.php 프로젝트: mroswald/invme
 public function register(App &$app)
 {
     $app->get('/version', function (Request $request, Response $response) {
         $response->getBody()->write(json_encode("v1.0.0"));
         return $response->withHeader('Access-Control-Allow-Origin', '*');
     });
     $app->options('/version', function (Request $request, Response $response, $args) use(&$self) {
         return $response->withHeader('Access-Control-Allow-Origin', '*')->withHeader('Access-Control-Allow-Headers', 'Content-Type');
     });
 }
 public function testOptionsRoute()
 {
     $path = '/foo';
     $callable = function ($req, $res) {
         // Do something
     };
     $app = new App();
     $route = $app->options($path, $callable);
     $this->assertInstanceOf('\\Slim\\Route', $route);
     $this->assertAttributeContains('OPTIONS', 'methods', $route);
 }