Skip to content

miyasinarafat/articles-database-rest-api

Repository files navigation

Articles Database

Installation steps

1. Clone repository

git clone git@github.com:miyasinarafat/articles-database-rest-api.git

2. Install the packages

composer install

3. Environment setup

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=

4. Docker setup

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

5. Application setup

# 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

Access APIs

http://localhost:8000/

POSTMAN COLLECTION: https://documenter.getpostman.com/view/1974679/2s93CHvFW1 image

Run unit test

./vendor/bin/sail artisan test

Screenshots from frontend app

1. Articles feed: image

2. Articles search: image

3. User profile: image

About

Laravel Restful APIs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published