@awes-io/nuxt-laravel
v0.7.2
Published
Awes.io module for connection with Laravel backend
Downloads
676
Readme
Awes.io Module for Connection With Laravel Backend
Basic usage
Folders structure
\
-- app
-- bootstrap
-- config
-- ...other Laravel folders
-- resources /
---- nuxt
------ assets
------ components
------ ... other Nuxt folders
-- nuxt.config.js
-- package.json
Place Nuxt project into resources/nuxt
folder, except nuxt.config.js
and package.json
. Place last mentioned files in the root of your project.
Follow next steps
- Ensure you have
@awes-io/laravel-nuxt
in yourcomposer.json
- Install the module
yarn add @awes-io/nuxt-laravel
- Modify
nuxt.config.js
// nuxt.config.js
export default {
mode: 'spa',
srcDir: 'resources/nuxt',
modules: [
'@awes-io/nuxt-laravel' // include first
// other nuxt modules
]
}
- Add scripts in your
package.json
// package.json
{
"scripts": {
"dev": "LARAVEL_URL=http://path.to.dev.laravel nuxt",
"build": "LARAVEL_URL=http://path.to.prod.laravel nuxt build",
"generate": "LARAVEL_URL=http://path.to.prod.laravel nuxt generate",
"start": "LARAVEL_URL=http://path.to.prod.laravel nuxt start"
}
}
- All done!
How the module works
This module will do the next steps:
- Add @nuxtjs/axios module
- Proxy requests on
/api/
route to your laravel backend - Move built files to
public
path onnuxt generate
command and createindex.html
for SPA entry point
Ensure to write proper commit message according to Git Commit convention