Skip to content

Commit

Permalink
Merge pull request #225 from sdleiw/add-composer-suggest-cors-bundle
Browse files Browse the repository at this point in the history
add composer suggestions
  • Loading branch information
lchrusciel authored Oct 15, 2017
2 parents b82a5ac + fe63cb0 commit d5298e8
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
53 changes: 53 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,59 @@ Rest of the command are executed inside `project` folder.
checkout_resolver:
pattern: "%sylius.security.shop_regex%/checkout/"
```
6. (optional) if you have installed `nelmio/NelmioCorsBundle` for Support of Cross-Origin Ajax Request,
1. Add the NelmioCorsBundle to the AppKernel
```php
// app/AppKernel.php
/**
* {@inheritdoc}
*/
public function registerBundles()
{
$bundles = array(
// ...
new Nelmio\CorsBundle\NelmioCorsBundle(),
// ...
);
// ...
}
```
2. Add the configuration to the `config.yml
```yml
# app/config/config.yml
# ...
nelmio_cors:
defaults:
allow_credentials: false
allow_origin: []
allow_headers: []
allow_methods: []
expose_headers: []
max_age: 0
hosts: []
origin_regex: false
forced_allow_origin_value: ~
paths:
'^/shop-api/':
allow_origin: ['*']
allow_headers: ['X-Custom-Auth']
allow_methods: ['POST', 'PUT', 'GET', 'DELETE']
max_age: 3600
'^/':
origin_regex: true
allow_origin: ['^http://localhost:[0-9]+']
allow_headers: ['X-Custom-Auth']
allow_methods: ['POST', 'PUT', 'GET', 'DELETE']
max_age: 3600
hosts: ['^api\.']
```
## Additional features
Expand Down
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,8 @@
"psr-4": {
"Tests\\Sylius\\ShopApiPlugin\\": "tests/"
}
},
"suggest": {
"nelmio/cors-bundle": "allows you to send Cross-Origin Ajax API Request"
}
}

0 comments on commit d5298e8

Please sign in to comment.