diff --git a/README.md b/README.md index 309d27a..f32fa59 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,27 @@ # PollVerlaine +A small alternative to Straw Poll. + +## Installation + +Clone the repository : +```sh +mkdir db && touch db/polls.db && composer install +``` + +Uncomment the dba extention in `php.ini` : +``` +extension=dba +``` + +Rename `config/app.example.php` to `config/app.php`. + +Sample configuration for nginx : +```nginx +location / +{ + try_files $uri /index.php =404; +} +``` + +## API diff --git a/composer.json b/composer.json index 788fbdf..16f28ae 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ }, { "name": "Tagada", - "email": "madeorsk@protonmail.com" + "email": "tagada@cant.at" } ] } diff --git a/index.php b/index.php index 55cb0a2..1d6001c 100644 --- a/index.php +++ b/index.php @@ -27,6 +27,7 @@ Flight::route("POST /polls", function () { else Flight::halt(403, "

403 Forbidden

Invalid Content-Type.

"); }); + Flight::route("GET /polls/@id:[a-fA-F0-9]+", function ($id) { $poll = Poll::load_poll($id); if ($poll) diff --git a/models/Poll.php b/models/Poll.php index f2ae80b..c06bf96 100644 --- a/models/Poll.php +++ b/models/Poll.php @@ -91,4 +91,4 @@ class Poll ]), $db); dba_close($db); } -} \ No newline at end of file +}