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.
Install react with npm
cd react
npm installTo install the backend,
composer i
php artisan key:generate
php artisan config:clear
php artisan migrate:fresh --seedFinally, run both command in local to start the project
npm run dev
php artisan serveTo 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
Clone the project
git clone https://github.com/carnal1234/laravel-api.gitGo to the project directory
cd laravel-apiFollowing Installation and Environment Variable instruction
Start the frontend
cd react
npm run devStart the backend and mysql server as well
php artisan serve