Updated README and API documentation.

This commit is contained in:
Madeorsk 2018-08-16 14:16:50 +02:00
parent 7b0a619b0e
commit 401adb726b
2 changed files with 29 additions and 22 deletions

37
API.md
View File

@ -4,7 +4,7 @@
### Create a poll ### Create a poll
``` ```
POST /polls POST /polls
``` ```
| Field | Description | Optional | | Field | Description | Optional |
@ -13,7 +13,7 @@ POST /polls
| `options` | All the options. Array of strings. | no | | `options` | All the options. Array of strings. | no |
| `settings` | A Settings object. | yes | | `settings` | A Settings object. | yes |
Return a Poll. Return a Poll with `delete_token`.
### Retrieve a poll ### Retrieve a poll
@ -26,7 +26,7 @@ Return a Poll.
### Vote ### Vote
``` ```
POST /polls/:id/vote POST /polls/:id/vote
``` ```
| Field | Description | Optional | | Field | Description | Optional |
| -------------- | -------------------------------------------- | ---------- | | -------------- | -------------------------------------------- | ---------- |
@ -37,7 +37,7 @@ Return a Poll.
### Delete a poll ### Delete a poll
``` ```
DELETE /polls/:id DELETE /polls/:id/:token
``` ```
Return a Poll. Return a Poll.
@ -46,22 +46,25 @@ Return a Poll.
### Poll ### Poll
| Attribute | Description | Nullable | | Attribute | Description | Nullable |
| --------------- | ------------------------------------ | ---------- | | ------------------ | ------------------------------------ | ---------- |
| `id` | | no | | `id` | | no |
| `title` | The question. | no | | `title` | The question. | no |
| `options` | All the options. Array of Options. | no | | `options` | All the options. Array of Options. | no |
| `settings` | A Settings object. | no | | `settings` | A Settings object. | no |
| `creation_date` | Creation date. | no | | `creation_date` | Creation date. | no |
| `delete_token` | Deletion token. | yes |
### Options ### Options
| Attribute | Description | Nullable | | Attribute | Description | Nullable |
| --------------- | ------------------------------------ | ---------- | | ------------------ | ------------------------------------ | ---------- |
| `label` | The option. | no | | `label` | The option. | no |
| `votes` | Numbers of votes. | yes |
### Settings ### Settings
| Attribute | Description | Nullable | | Attribute | Description | Nullable |
| --------------- | ------------------------------------ | ---------- | | ------------------ | ----------------------------------------------- | ---------- |
| `unique_ip` | One vote per IP address. Boolean. | yes | | `unique_ip` | One vote per IP address. Boolean. | yes |
| `multiple_choices` | Allow multiple choices in one vote. Boolean. | yes |

View File

@ -4,26 +4,30 @@ A small alternative to Straw Poll.
## Installation ## Installation
Clone the repository : Clone the repository:
```sh ```sh
mkdir db && touch db/polls.db && composer install mkdir db && touch db/polls.db && composer install
``` ```
Uncomment the `dba` extention in `php.ini` : Enable the `dba` extension in `php.ini`:
``` ```
extension=dba extension=dba
``` ```
### Configuration
Rename `config/app.example.php` to `config/app.php`. Rename `config/app.example.php` to `config/app.php`.
Sample configuration for nginx : Configure `app_url` to the root url of Poll Verlaine.
Sample configuration for nginx:
```nginx ```nginx
location / location /
{ {
try_files $uri /index.php =404; try_files $uri /index.php;
} }
``` ```
## API ## API
See [API.md](API.md). See [API.md](API.md).