Skip to content

api #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public function registerBundles()
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new \FOS\RestBundle\FOSRestBundle(),
new AppBundle\AppBundle(),
];

Expand Down
2 changes: 0 additions & 2 deletions app/Resources/views/test/list.html.twig

This file was deleted.

7 changes: 0 additions & 7 deletions app/Resources/views/test/liste.html.twig

This file was deleted.

3 changes: 0 additions & 3 deletions app/Resources/views/test/page.html.twig

This file was deleted.

13 changes: 11 additions & 2 deletions app/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ framework:
form: ~
csrf_protection: ~
validation: { enable_annotations: true }
#serializer: { enable_annotations: true }
serializer: { enable_annotations: true }
templating:
engines: ['twig']
default_locale: '%locale%'
Expand All @@ -32,7 +32,6 @@ framework:
assets: ~
php_errors:
log: true

# Twig Configuration
twig:
debug: '%kernel.debug%'
Expand Down Expand Up @@ -67,3 +66,13 @@ swiftmailer:
username: '%mailer_user%'
password: '%mailer_password%'
spool: { type: memory }

fos_rest:
routing_loader:
include_format: false
view:
view_response_listener: true
format_listener:
rules:
- { path: '^/api', priorities: ['json'], fallback_format: 'json', prefer_extension: false }
- { path: '^/', priorities: ['html'], fallback_format: 'html', prefer_extension: false }
17 changes: 16 additions & 1 deletion app/config/routing.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
app:
resource: '@AppBundle/Controller/'
type: annotation
type: annotation

articles:
type: rest
prefix: /api
resource: AppBundle\Controller\ArticleController

users:
type: rest
prefix: /api
resource: AppBundle\Controller\UserController

comments:
type: rest
prefix: /api
resource: AppBundle\Controller\CommentController
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
"php": "^7.0",
"doctrine/doctrine-bundle": "^1.6",
"doctrine/orm": "^2.5",
"friendsofsymfony/rest-bundle": "^2.1",
"guzzlehttp/guzzle": "~6.0",
"incenteev/composer-parameter-handler": "^2.0",
"sensio/distribution-bundle": "^5.0.19",
"sensio/framework-extra-bundle": "^3.0.2",
Expand Down
Loading