Laravel is a web application framework with expressive, elegant syntax. We 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, such as:
- Simple, fast routing engine.
- Powerful dependency injection container.
- Multiple back-ends for session and cache storage.
- Expressive, intuitive database ORM.
- Database agnostic schema migrations.
- Robust background job processing.
- Real-time event broadcasting.
Laravel is accessible, powerful, and provides tools required for large, robust applications.
Create a web app that will have two parts. The first part involves entries (similar to blog posts) from registered users (functionality to view, create, and edit entries). The second part is to be able to see a single user's entries and tweets (from Twitter).
Framework: Laravel 6 + VueJs
Operation System: Debian 9 | Apache 2.4.25 | PHP 7.3.11 | MariaDB (MySQL) 10.1.41
Dependencies: Laravel 6 Dependencies, cURL PHP extension, NodeJS
-
Clone the repository:
$ git clone https://github.com/rmendoza83/UserEntriesTwitter.git user-entries
-
Move to the new cloned folder:
$ cd user-entries
-
Prepare the VueJS frontend code:
$ npm install $ npm run prod
-
Prepare the Lavarel code:
$ composer install $ cp .env.example .env
-
Fill the following configuration in your .env file:
- Configure your MariaDB Connection
DB_CONNECTION=mysql DB_HOST=localhost DB_PORT=3306 DB_DATABASE={YOUR_DESIRED_DBNAME} DB_USERNAME={MARIADB_USERNAME} DB_PASSWORD={MARIADB_PASSWORD}
- Configure your Twitter App keys
For this step you can get this values in the following address developer.twitter.com/en/apps
TWITTER_CONSUMER_KEY= TWITTER_CONSUMER_SECRET= TWITTER_ACCESS_TOKEN= TWITTER_ACCESS_TOKEN_SECRET=
-
Create an empty database inside MariaDB:
$ mysql -u root -p $ Enter password: [type your {MARIADB_PASSWORD}] MariaBD [()]> CREATE DATABASE {YOUR_DESIRED_DBNAME}; MariaBD [()]> quit
-
Configure Laravel Framework to get up the app (Create the Key App, Create the database, and Create Test data)
$ php artisan key:generate $ php artisan migrate $ php artisan db:seed
-
Done. Just navigate to the configurated folder on Apache using a Navigator.
In this case we need to create a new Virtual Host on Apache Environment, the steps are very similar to the General Instructions, but we need to add some steps before:
-
Create the project directory inside Apache documents folder (In Debian 9 by default: /var/www)
$ mkdir -p /var/www/jobsitychallenge/reinaldo_mendoza $ cd /var/www/jobsitychallenge/reinaldo_mendoza
-
Clone repository
$ git clone https://github.com/rmendoza83/UserEntriesTwitter.git .
-
Create Virtual Host reinaldo-mendoza.jobsitychallenge.com
$ cd /etc/apache2/sites-available $ touch reinaldo-mendoza.jobsitychallenge.com.conf
Add the following code in the new file reinaldo-mendoza.jobsitychallenge.com.conf created in the previous step:
<VirtualHost *:80> # The ServerName directive sets the request scheme, hostname and port that # the server uses to identify itself. This is used when creating # redirection URLs. In the context of virtual hosts, the ServerName # specifies what hostname must appear in the request's Host: header to # match this virtual host. For the default virtual host (this file) this # value is not decisive as it is used as a last resort host regardless. # However, you must set it for any further virtual host explicitly. ServerName reinaldo-mendoza.jobsitychallenge.com ServerAlias reinaldo-mendoza.jobsitychallenge.com ServerAdmin rmendoza83@gmail.com DocumentRoot /var/www/jobsitychallenge/reinaldo_mendoza/public <Directory /var/www/jobsitychallenge/reinaldo_mendoza/public> Options -Indexes +FollowSymLinks Allowoverride All </Directory> # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # It is also possible to configure the loglevel for particular # modules, e.g. #LogLevel info ssl:warn ErrorLog ${APACHE_LOG_DIR}/reinaldo-mendoza.jobsitychallenge.com_error.log CustomLog ${APACHE_LOG_DIR}/reinaldo-mendoza.jobsitychallenge.com_access.log combined </VirtualHost>
-
Enable the new site reinaldo-mendoza.jobsitychallenge.com and restart the Apache service:
$ a2ensite reinaldo-mendoza.jobsitychallenge.com $ sudo /etc/init.d/apache2 restart $ cd /var/www/jobsitychallenge/reinaldo_mendoza
-
Now the folders are configurated for Apache Service, from here we can continue from the step 3 specified in General Instructions to get the site working fine.
- Reinaldo Mendoza - rmendoza83@gmail.com