This repository contains all necessary code in order to run the Acilia Api REST as part of a tecnical challenge
The project is built with a several libraries as follow:
- composer create-project symfony/skeleton:"^4.4" acilia_api_rest
- composer require symfony/orm-pack (database conections)
- composer require annotations (route annotations)
- composer require symfony/maker-bundle --dev (entty creator)
- composer require symfony/twig-bundle (templates)
- composer require symfony/asset
- composer require nelmio/api-doc-bundle (api documentation)
- composer require trikoder/oauth2-bundle nyholm/psr7 (oauth2 authentication/authorization)
- composer require --dev symfony/phpunit-bridge (testing)
- composer require --dev symfony/browser-kit symfony/css-selector
- composer require symfony/validator
This project requires postgres
database with postgres
user with postgres
password to running in the system. If you want other database engine just modify .env file
Clone the repository and access to folder created, run composer, create database, schema and start server
git clone https://github.com/sebardo/acilia_api_rest.git
cd acilia_api_rest
composer install
./bin/console doctrine:database:create
./bin/console doctrine:schema:create
symfony server:start
In order to enable the OAuth authentication flow a public/private keypair
must be generated. Under root directory /
, run:
openssl genrsa -out private.key 2048
openssl rsa -in private.key -pubout -out public.key
Now can create OAuth client
./bin/console trikoder:oauth2:create-client
Add CLIENT_ID and CLIENT_SECRET returned by command above on phpunit.xml.dist
file
Now you can visit API REST documentation page and testing category and product endpoints at https://127.0.0.1:8000/api/doc
Can run testing to check all work well
./bin/phpunit
Dario Sebastian Sasturain 4/2021