DS
Size: a a a
DS
Л
i
Р🔐
e
AF
NL
ak
ЕЧ
ЮЧ
ЮЧ
function withCORSHeaders(Response $resp) {
return $resp
->withHeader('Access-Control-Allow-Origin', '*')
->withHeader('Access-Control-Allow-Headers', 'X-Requested-With, Content-Type, Accept, Origin, Authorization');
}
$app->options('/guides', function (Request $req, Response $resp, array $args) use ($container) {
return withCORSHeaders($resp)
->withHeader('Access-Control-Allow-Methods', implode(',', ['GET', 'POST']));
});
$app->get('/guides', function (Request $req, Response $resp, array $args) use ($container) {
$guides = $container->get('db')->table('guides')->get();
return withCORSHeaders($resp)->withJson($guides);
});
ЮЧ
ЮЧ
IS
GV
ЮЧ
ЮЧ
GV
ЮЧ
ЮЧ