Code for tutorial for Laravel blog with Strapi v4.
- Node v12 or v14. v14 is recommended
- PHP >= 7.3
- Composer
Change to the strapi directory and run the following:
npm installThen, change to the blog directory and run the following:
composer installYou also need to copy and rename .env.example to .env:
cp .env.example .envThen, add the following environment variables at the end of .env:
STRAPI_URL=
STRAPI_API_TOKEN=
STRAPI_URL is the URL to your Strapi installation. If you're running it local, it should be http://localhost:1337.
STRAPI_API_TOKEN is the API Token you create in Strapi Admin. You can check the tutorial to learn how to do that.
Change to the strapi directory and run the following command:
npm run developThis will start Strapi's server at http://localhost:1337.
You'll need to add the content types and entries using the admin. You can follow along in the tutorial to learn how to do that.
Then, go to the blog directory using another terminal and run the following command:
php artisan serveThis will start the Laravel server at http://localhost:8000.