This API serves as the backend for the PNC blog site. It provides various endpoints to interact with the database and perform actions such as user authentication, manage users, posting and managing blog posts, follow-unfollow feature, and more. This README will guide you through setting up and using the API with your frontend.
Make sure you have installed the following:
- Open XAMPP Control Panel
- Start Apache & MySQL servers
- Clone the repository with CLI or GitHub Desktop
- Open Visual Studio Code
- Choose a folder where you want to clone the repository in File > Open Folder
- Open Visual Studio Code terminal (Ctrl + `) and enter the following commands:
Clone the repository
git clone https://github.com/burnjoe/pnc-blog-api.git
Change terminal directory
cd pnc-blog-api
- Open GitHub Desktop
- Clone the repository in File > Clone Repository
Select URL tab and paste the following:
https://github.com/burnjoe/pnc-blog-api.git
- Choose a folder where you want to clone the repository and then Clone
- Open the cloned repository in Visual Studio Code in Repository > Open in Visual Studio Code
Install composer to the project
composer install
Install npm to the project
npm install
Create .env
copy .env.example .env
Generate new app key
php artisan key:generate
Run the migration
php artisan migrate
When prompted to create the database, type yes
Would you like to create it? (yes/no) [no]
> yes
Run the seeder
php artisan db:seed
Generate encryption key to generate secure access tokens. See Laravel Passport.
php artisan passport:install
When prompted to run pending database migration, type yes
Would you like to run all pending database migrations? (yes/no) [yes]:
> yes
When prompted to create clients, type yes
Would you like to create the "personal access" and "password grant" clients? (yes/no) [yes]:
> yes
After installing passport, copy the generated Client ID
and Client Secret
to the newly created variables in .env
file
PASSPORT_PERSONAL_ACCESS_CLIENT_ID = "1"
PASSPORT_PERSONAL_ACCESS_CLIENT_SECRET = "Hl0rRWjgKact31fjZupAMK0E7HwksWN2MhrznmL8"
Start local development server for your laravel app
php artisan serve