Skip to content

carnal1234/laravel-api

Repository files navigation

Laravel RESTFul API

This project is about building REST API with Laravel as Backend and React as FrontEnd.

The goal is to create CRUD operation with interactive UI as well as a simple authenicated system.

Installation

Install react with npm

cd react
npm install

To install the backend,

composer i
php artisan key:generate
php artisan config:clear
php artisan migrate:fresh --seed

Finally, run both command in local to start the project

npm run dev
php artisan serve

Environment Variables

To run this project, you will have to add two .env file to make it work.

Under main directory, Copy .env.example as .env and change the following setting

Notice that APP_KEY would be generated by php artisan key:generate

APP_URL=

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=database_name
DB_USERNAME=username
DB_PASSWORD=password

Under react directory, create another .env with custom setting

VITE_API_BASE_URL=http://localhost:8000
VITE_FRONTEND_BASE_URL=http://localhost:3000

Run Locally

Clone the project

git clone https://github.com/carnal1234/laravel-api.git

Go to the project directory

cd laravel-api

Following Installation and Environment Variable instruction

Start the frontend

cd react
npm run dev

Start the backend and mysql server as well

php artisan serve

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published