This is a sample project that uses React.js SSR(Server side rendering) with Laravel. It also demonstrates the use of routing and forms.
There are 2 folders:
- frontend : contains the React project
- backend : contains php Laravel project
To get started, do the following:
Swtich to the frontend folder:
cd frontend
- Install npm packages:
yarn install
- Run development server:
yarn dev
- Build production bundle:
yarn build
This step bundles all static resources and and adds them to: ./backend/public/
folder.
This project uses the spatie/laravel-server-side-rendering package.
Swtich to the backend folder:
cd backend
To get started:
- Install composer packages
composer install
- Set up the NODE_PATH environment variable in your .env:
ENV=production
NODE_PATH=/path/to/my/node
for nvm users:
NODE_PATH='/Users/<USERNAME>/.nvm/versions/node/v<NODE_VERSION>/bin/node'
- Run:
php artisan serve