git clone git@github.com:miyasinarafat/articles-database-rest-api.git
composer install
Setup necessary config on .env for mysql, memcached, and elasticsearch
cp .env.example .env
Add env key for newsapi.org:
# News APIs
NEWS_API_ORG_API_TOKEN=
Setup necessary config on .env for mysql, memcached, and elasticsearch
# Build docker compose
./vendor/bin/sail build
# Run docker compose to run background containers
./vendor/bin/sail up -d
# Generate encryption key
./vendor/bin/sail artisan key:generate
# Create database tables
./vendor/bin/sail artisan migrate
# Setting up database with initial categories and sources:
./vendor/bin/sail artisan app:InitDatabaseSetup
# Pull and save articles from APIs by sources:
./vendor/bin/sail artisan app:RetrieveNewsApiOrgArticles
# Indexing articles to Elasticsearch for search:
./vendor/bin/sail artisan search:ArticlesReindex
# Example indexing:
yellow open articles _NSllINtRe2gqcHW5sFqKQ 1 1 279 0 234.1kb 234.1kb
http://localhost:8000/
POSTMAN COLLECTION: https://documenter.getpostman.com/view/1974679/2s93CHvFW1
./vendor/bin/sail artisan test