-
Notifications
You must be signed in to change notification settings - Fork 12
Getting Started
Marina edited this page Oct 17, 2021
·
5 revisions
Live API can be found here:
git clone https://github.com/Say-Their-Name/api.git
cd api
For this to work, you will need:
- php7.2 or higher
- mysql
- composer
on your system.
Do not do this directly. See Setup with Docker below.
cd into project root and run the following:
// Create your environment file
cp .env.example .env
// install PHP dependancies
composer install
// create an encryption key
php artisan migrate
// create a database file
touch database/database.sqlite
// make sure the database driver is set to sqlite in the .env file
open .env and change:
DB_CONNECTION=mysql
to
DB_CONNECTION=sqlite
// run migrations to set up database and include dummy data
php artisan migrate:fresh --seed
// Run the local server
php artisan serve
This is the recommended setup,as it prevents many PHP or dependency issues (compatibility, missing PHP extension...).
- Docker
- Docker Compose
- Taskfile (optional,but much recommended)
- on macOS,
iproute2mac
(brew install iproute2mac
)
git clone https://github.com/Say-Their-Name/api.git
cd api
# Build the development Docker image
task build
# Start the stack
task
# Install vendor dependencies
task vendor
# Prepare the database
task dbreset
# Run shell in the running container
task sh
## from shell you can run composer, artisan, etc
Go to http://localhost:8000
It's accessible at http://localhost:48080
Login using the user/password from the .env.example (should be stn
/stn
)
If Docker setup isn't possible, other ways to setup are available here
GET People
List all
http://localhost:8000/api/people
Get Single
http://localhost:8000/api/people/{firstname-lastname}
Filter by name
http://localhost:8000/api/people?name=george-floyd
Filter by country
http://localhost:8000/api/people?country=united-states
Filter by city
http://localhost:8000/api/people?city=minnesota
GET Donations
List Types
http://localhost:8000/api/donation-types
List all
http://localhost:8000/api/donations
Get Single
http://localhost:8000/api/donations/{slug}
Filter by Type
http://localhost:8000/api/donations?type=victims
Filter by Victim
http://localhost:8000/api/donations?name=george-floyd
GET Petitions
List Types
http://localhost:8000/api/petition-types
List All
http://localhost:8000/api/petitions
Get Single
http://localhost:8000/api/petitions/{slug}
Filter by Type
http://localhost:8000/api/petitions?type=victims
Filter by Person
http://localhost:8000/api/petitions?name=george-floyd