mirror of
https://git.cant.at/Madeorsk/PollVerlaine
synced 2024-11-22 12:44:32 +01:00
Merge branch 'tagada' of Madeorsk/PollVerlaine into master
This commit is contained in:
commit
559b9e19ac
25
README.md
25
README.md
@ -1,2 +1,27 @@
|
|||||||
# PollVerlaine
|
# 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
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Tagada",
|
"name": "Tagada",
|
||||||
"email": "madeorsk@protonmail.com"
|
"email": "tagada@cant.at"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -20,13 +20,14 @@ Flight::route("POST /polls", function () {
|
|||||||
$request_json = $request->data;
|
$request_json = $request->data;
|
||||||
$poll = Poll::create_poll($request_json);
|
$poll = Poll::create_poll($request_json);
|
||||||
if ($poll)
|
if ($poll)
|
||||||
Flight::json(format_poll($poll), 206);
|
Flight::json(format_poll($poll), 201);
|
||||||
else
|
else
|
||||||
Flight::halt(403, "<h1>403 Forbidden</h1><h3>Invalid data.</h3>");
|
Flight::halt(403, "<h1>403 Forbidden</h1><h3>Invalid data.</h3>");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Flight::halt(403, "<h1>403 Forbidden</h1><h3>Invalid Content-Type.</h3>");
|
Flight::halt(403, "<h1>403 Forbidden</h1><h3>Invalid Content-Type.</h3>");
|
||||||
});
|
});
|
||||||
|
|
||||||
Flight::route("GET /polls/@id:[a-fA-F0-9]+", function ($id) {
|
Flight::route("GET /polls/@id:[a-fA-F0-9]+", function ($id) {
|
||||||
$poll = Poll::load_poll($id);
|
$poll = Poll::load_poll($id);
|
||||||
if ($poll)
|
if ($poll)
|
||||||
|
Loading…
Reference in New Issue
Block a user