API endpoints for Recipe Manager project by https://github.com/PascaleStark Test server php -S localhost:8000 -t public/
| Endpoint | ex | Function |
|---|---|---|
| GET /recipes | Get all recipes | |
| GET /recipes/name/{name} | Get recipe by name | |
| GET recipes/where | recipes/where?id=1 | Get recipe with a condition |
| GET /recipes/search | GET /recipes/search?q=pizza&page=1&filter={field} | Search for recipe with a query, paginated |
| GET recipes/file/{id} | recipe media file id | Get a recipe media file |
| POST recipes/category | post a recipe category | |
| POST recipes/upload/{id} | post a recipe media file | |
| POST /recipes | Post a recipe | |
| DELETE recipes/delete/{id} | Delete a recipe | |
| DELETE recipes/config/deletecache | Clear config cache | |
| PATCH recipes/favourites/{id}} | Set a recipe as favourite | |
| PATCH recipes/featured/{id} | Set a recipe as featured | |
| PATCH recipes/update/{id} | Update a recipe field |
- composer install
- point your .env to the created db (DATABASE_URL=mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=5)
- bin/console doctrine:database:create
- bin/console doctrine:schema:drop -n -q --force --full-database && rm migrations/*.php && bin/console make:migration && bin/console doctrine:migrations:migrate -n -q
| Config Key | Config Value | Function |
|---|---|---|
| app-version | 1 | Current application version |
| allowed-extensions | gif,jpg,jpeg,png | File extensions that are allowed for uploading purpose |
| max-file-size | 20 | Max upload file size in MBs |
| image-url | http://{serverIP}/recipesAPI/public/ | images location on the server |
| rate-limit-requests | 3 | This is the number of allowed requests per minute |
Results are pagniated by default.
APIs use symfony's RateLimit factory. The limit can be configured using the config key "rate-limit-requests".