-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
1,297 additions
and
44 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,3 +26,9 @@ DATABASE_URL=sqlite:///%kernel.project_dir%/var/data.db | |
# DATABASE_URL="mysql://db_user:[email protected]:3306/db_name?serverVersion=5.7" | ||
# DATABASE_URL="postgresql://db_user:[email protected]:5432/db_name?serverVersion=13&charset=utf8" | ||
###< doctrine/doctrine-bundle ### | ||
|
||
###> lexik/jwt-authentication-bundle ### | ||
JWT_SECRET_KEY=%kernel.project_dir%/config/jwt/private.pem | ||
JWT_PUBLIC_KEY=%kernel.project_dir%/config/jwt/public.pem | ||
JWT_PASSPHRASE=cde703ea51cc6b270df31f4c8232d98f23da500b8b232252758dcd1b33b22c5b | ||
###< lexik/jwt-authentication-bundle ### |
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,30 @@ | ||
# RESTful Webservices in Symfony | ||
|
||
## Coding Challenge 11 - API Documentation | ||
|
||
### Tasks | ||
|
||
Let's document our API using the Nelmio ApiDocBundle. | ||
|
||
### Solution | ||
|
||
- require Nelmio's ApiDocBundle: `composer req nelmio/api-doc-bundle` | ||
- adjust the bundle's configuration: | ||
|
||
```yaml | ||
nelmio_api_doc: | ||
documentation: | ||
info: | ||
title: RESTful Webservices in Symfony | ||
description: "Workshop: RESTful Webservices in Symfony!" | ||
version: 1.0.0 | ||
areas: | ||
path_patterns: | ||
- ^/api(?!/doc$) # Accepts routes under /api except /api/doc | ||
- ^/workshops | ||
- ^/attendees | ||
``` | ||
- add some annotation to your controllers, check https://github.com/zircote/swagger-php/tree/master/Examples for examples | ||
- to be able to see the api documentation website, you need to install Twig and the Asset component `composer require twig asset` | ||
- and adjust the routing configuration for the `nelmio/api-doc-bundle` in `config/routes/nelmio_api_doc.yaml` |
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
Oops, something went wrong.