Package Data | |
---|---|
Maintainer Username: | cretueusebiu |
Package Create Date: | 2018-01-09 |
Package Last Update: | 2021-05-30 |
Home Page: | https://laravel-nuxt.cretueusebiu.com |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-15 03:04:40 |
Package Statistics | |
---|---|
Total Downloads: | 6,233 |
Monthly Downloads: | 3 |
Daily Downloads: | 0 |
Total Stars: | 1,154 |
Total Watchers: | 42 |
Total Forks: | 262 |
Total Open Issues: | 13 |
A Laravel-Nuxt starter project template.
composer create-project --prefer-dist cretueusebiu/laravel-nuxt
.env
to set your database connection details and APP_URL
(the url to your Laravel application)php artisan key:generate
and php artisan jwt:secret
)php artisan migrate
yarn
/ npm install
npm run dev
npm run build
npm run start
For Nginx you can add a proxy using the follwing location block:
server {
location / {
proxy_pass http://HOST:PORT;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
Where HOST
is the ip address of your server and PORT
is the port you're running the application (3000 by default).
In production you need a process manager to keep the Node server alive forever:
# install pm2 process manager
npm install -g pm2
# startup script
pm2 startup
# start process
pm2 start npm --name "laravel-nuxt" -- run start
# save process list
pm2 save
# list all processes
pm2 l
After each deploy you'll need to restart the process:
pm2 restart laravel-nuxt
If you don't want server side rendering you can use the mode option:
mode: 'spa'
and '~plugins/nuxt-client-init'
in client/nuxt.config.js
// ->prefix('api')
in app/Providers/RouteServiceProvider.php
APP_URL=http://example.com/api
and CLIENT_URL=http://example.com
in your .env
npm run build
Make sure to read the Nuxt docs.
client/router.js
.package.json
into client/
and remove config path option from the scripts section. Also make sure to add the env variables in client/.env
.Please see CHANGELOG for more information what has changed recently.