-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
minor #973 Added a mini-tutorial about FOSRestBundle and EasyAdmin in…
…tegration (javiereguiluz) This PR was merged into the master branch. Discussion ---------- Added a mini-tutorial about FOSRestBundle and EasyAdmin integration This fixes #955. Commits ------- 71f2b82 Added a mini-tutorial about FOSRestBundle and EasyAdmin integration
- Loading branch information
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
How To Integrate FOSRestBundle and EasyAdmin | ||
============================================ | ||
|
||
[FOSRestBundle][1] provides various tools to rapidly develop RESTful APIs in | ||
Symfony applications. EasyAdmin doesn't integrate with FOSRestBundle features in | ||
any way, but there are some options that you may need to configure to avoid | ||
errors in backend URLs. | ||
|
||
Format Listener | ||
--------------- | ||
|
||
This listener provided by FOSRestBundle determines the best format for the | ||
request based on the HTTP Accept header included in the request and some format | ||
priority configuration. | ||
|
||
Since EasyAdmin doesn't define the format of the request, it's recommended to | ||
define this format for all the backend URLs using the FOSRestBundle | ||
configuration. | ||
|
||
Open your main configuration file, look for the `fos_rest` configuration block | ||
and add the following `format_listener` configuration (change the value of | ||
the `path` option if your backend customized the URL prefix): | ||
|
||
```yaml | ||
# app/config/config.yml | ||
fos_rest: | ||
format_listener: | ||
enabled: true | ||
rules: | ||
- { path: '^/admin', methods: ['GET', 'POST'], priorities: ['html'], | ||
fallback_format: 'html', prefer_extension: false } | ||
``` | ||
|
||
[1]: https://github.com/FriendsOfSymfony/FOSRestBundle |