@paul-bfi/polls-data v0.0.1
Polls Results Service
An HTTP API service that exposes Sight and Sound poll data, built in PHP and Laravel.
Requires Composer 2.4, PHP 8.1 (with sqlite3 module php8.1-sqlite3
), SQLite 3.
To run code coverage you should also have XDebug installed (pecl install xdebug
)
Development Setup
Clone the repository, then install dependencies using composer install
.
Create your environment file using cp .env.example .env
.
Create the sqlite database with touch database/database.sqlite
.
Run database migrations using php artisan migrate
.
Create an application key: php artisan key:generate
.
Next you will need to ingest the results CSV as exported from the D7 Sight and Sound polls service.
If you don't have this file available, you can use results.example.csv
: php artisan ingest results.example.csv
.
Start the development server: php artisan serve
.
To run tests: php artisan test
To run code coverage: XDEBUG_MODE=coverage php artisan test --coverage
. You can add the --min
flag to require a minimum coverage threshold.
Node Client
This repository also contains the NodeJS client library.
Development
For testing the node client, Node 18 is required.
To publish the library, you'll need to create a github client token and log in to the github package registry.
Then you can publish as normal with npm publish
.
Installation
This library is hosted in the GitHub package registry.
To tell NPM where to find the package, you'll need to
create a .npmrc
file in your project with the following line:
@bfi-digital:registry=https://npm.pkg.github.com
Then install with npm install @bfi-digital/polls-data
.
2 years ago