Skip to content

LuisMiguelSS/reriid-laravel-backend

Repository files navigation

Reriid

BACKEND

Index

  1. About this Backend
  2. Laravel
  3. Npm
  4. License

1. About this Backend

This backend provides an API for dealing with the database information. It uses Passport, which is an OAuth2 and authentication package.

OAuth 2.0

The OAuth 2.0 Authorization Framework, defined in the RFC-6749, provides authorization control for all kinds of applications, wether they may be web or desktop based.

Testing

In order to test locally firstly you'll need to have a working web server and database.

  1. Configuring the .env file. You may use the same configuration from Deployment but you must change the following variables as follows:
APP_ENV=development
APP_DEBUG=true
...
  1. Install Passport.
php artisan passport:install
  1. If after the install you don't have any keys stored in the .env file under the APP_KEY variable, you must run:
php artisan key:generate
  1. Run the migrations.
php artisan migrate
  1. Running the live server.
  • Use the command php artisan serve
  • On a new terminal execute php artisan queue:work --queue=email
  1. Initialize the Websocket server
php artisan websocket:init

Or, in short:

php artisan serve
php artisan serve --host=my.local.network.serverIp --port=8000
php artisan queue:work --queue=email
php artisan websocket:init

Deployment

This guide takes into account that the web server has been previously configured. To successfully deploy this backend, you must:

  1. Properly configure the .env file.
APP_ENV=production
APP_DEBUG=false
...
APP_URL=https://...
...
DB_CONNECTION=... <- wether it is mysql or other DB
DB_HOST=... <- host (IP) in charge of the DB
DB_PORT=...
DB_DATABASE=... <- name of the DB
DB_USERNAME=...
DB_PASSWORD=...
...
QUEUE_CONNECTION=database
...
MAIL_DRIVER=smtp
MAIL_HOST=...
MAIL_PORT=...
MAIL_USERNAME=... <- email account
MAIL_PASSWORD=...
MAIL_ENCRYPTION=... <- SSL/TLS/STARTTLS...
MAIL_FROM_ADDRESS=... <- email account
MAIL_FROM_NAME="${APP_NAME}"
...
  1. Generate application keys.
php artisan key:generate
  1. Install Passport.
php artisan passport:install
  1. Migrate the database.
php artisan migrate --force
  1. Optimize autoloader.
composer install --optimize-autoloader --no-dev
  1. Optimize configurations.
php artisan config:cache
  1. Optimize API routes.
php artisan route:cache
  1. Precompile views.
php artisan view:cache
  1. Install & configure supervisor. This will take care of the queued jobs such as email sending and the websocket for the realtime chat.
  2. Ready to go!

2. About Laravel

Laravel is a web application framework with expressive, elegant syntax. The authors believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects.

More info: Laravel website.

3. About Npm

npm is the package manager for the Node JavaScript platform. It puts modules in place so that node can find them, and manages dependency conflicts intelligently.

It is extremely configurable to support a wide variety of use cases. Most commonly, it is used to publish, discover, install, and develop node programs.

Discover more at the NPM site.

License - ©Copyright

This work is copyrighted by Luis Miguel Soto Sánchez and thus, cannot be distributed or copied in any way unless strictly told by the author.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published