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
```
POST /polls
POST /polls
```
| Field | Description | Optional |
@ -13,7 +13,7 @@ POST /polls
| `options` | All the options. Array of strings. | no |
| `settings` | A Settings object. | yes |
Return a Poll.
Return a Poll with `delete_token`.
### Retrieve a poll
@ -26,7 +26,7 @@ Return a Poll.
### Vote
```
POST /polls/:id/vote
POST /polls/:id/vote
```
| Field | Description | Optional |
| -------------- | -------------------------------------------- | ---------- |
@ -37,7 +37,7 @@ Return a Poll.
### Delete a poll
```
DELETE /polls/:id
DELETE /polls/:id/:token
```
Return a Poll.
@ -46,22 +46,25 @@ Return a Poll.
### Poll
| Attribute | Description | Nullable |
| --------------- | ------------------------------------ | ---------- |
| `id` | | no |
| `title` | The question. | no |
| `options` | All the options. Array of Options. | no |
| `settings` | A Settings object. | no |
| `creation_date` | Creation date. | no |
| Attribute | Description | Nullable |
| ------------------ | ------------------------------------ | ---------- |
| `id` | | no |
| `title` | The question. | no |
| `options` | All the options. Array of Options. | no |
| `settings` | A Settings object. | no |
| `creation_date` | Creation date. | no |
| `delete_token` | Deletion token. | yes |
### Options
| Attribute | Description | Nullable |
| --------------- | ------------------------------------ | ---------- |
| `label` | The option. | no |
| Attribute | Description | Nullable |
| ------------------ | ------------------------------------ | ---------- |
| `label` | The option. | no |
| `votes` | Numbers of votes. | yes |
### Settings
| Attribute | Description | Nullable |
| --------------- | ------------------------------------ | ---------- |
| `unique_ip` | One vote per IP address. Boolean. | yes |
| Attribute | Description | Nullable |
| ------------------ | ----------------------------------------------- | ---------- |
| `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
Clone the repository :
Clone the repository:
```sh
mkdir db && touch db/polls.db && composer install
```
Uncomment the `dba` extention in `php.ini` :
Enable the `dba` extension in `php.ini`:
```
extension=dba
```
### Configuration
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
location /
{
try_files $uri /index.php =404;
try_files $uri /index.php;
}
```
## API
See [API.md](API.md).
See [API.md](API.md).