A demo project based on Laravel5.8 and Vue2(Frontend separated with Backend)
Preconditions for this app to run
- php 7.1+
- mysql 5.6+
- node 12.18.4
- npm 6.14.6
- nginx
The main package dependencies for this project
For Laravel part
- tymon/jwt-auth ^1.0
- lcobucci/jwt 3.3.3
- guzzlehttp/guzzle ^6.5(Laravel 6+ may come with it at default)
- aws/aws-sdk-php ^3.216
- intervention/image ^2.7
- picqer/php-barcode-generator ^0.3.0
- setasign/fpdi ^2.3
- setasign/fpdi-fpdf ^2.3
- setasign/fpdi-tcpdf ^2.3
For Vue2 part
- axios ^0.26.0
- element-ui ^2.15.6
- js-cookie ^2.2.1
- js-md5 ^0.7.3
- jsencrypt ^3.0.0-rc.1
- sass ^1.32.0
- sass-loader ^10.1.0
- vue-i18n ^8.22.0
Instructions for the Backend depolyment
- cd YOUR_WEB_ROOT/backend/bootstrap and create a new directory(cache) via 'mkdir cache' command;
- cd .. and then run 'composer install'
- copy or touch a .env file and paste the proper configuration values to it.
- Run
php artisan jwt:secret
or set a JWT_SECRET=XXXXX at the end of .env - Create a database and a credentials for it and set it into the .env file
- Run
php artisan migrate
to build the db table instructure. - Edit the seeder file
YOUR_WEB_ROOT/backend/database/seeds/BookDataGatherSeeder
and uncomment all code lines in therun()
method of this seeder and save it. - Run
php artisan db:seed --class=BookDataGatherSeeder
to gather some books from an online book website. - Edit the seeder file
YOUR_WEB_ROOT/backend/database/seeds/CreateAdminUserSeeder
and uncomment all code lines in therun()
method of this seeder and save it. - Run
php artisan db:seed --class=CreateAdminUserSeeder
to create a admin user and a member user for this application.
Instructions for the Frontend depolyment
- cd YOUR_WEB_ROOT/frontend and create a new directory(dist) via 'mkdir dist' command;
- Run
npm install
- Run
npm run build
Finally, just depoly it as you depoly other website in nginx.
#######PLEASE MAKE SURE THE PHP REQUEST PART CORRECT#########
.....
root /YOUR_WEB_ROOT/frontend/dist;
location / {
`index index.html index.htm;`
`try_files $uri $uri/ /index.php?$query_string;`
}
.....
location ~ \.php$ {
`root /YOUR_WEB_ROOT/backend/public;`
`fastcgi_pass unix:/dev/shm/php-cgi.sock;`
`fastcgi_index index.php;`
`fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;`
`include fastcgi.conf;`
}
.....
################