novia713
9/2/2016 - 8:14 PM

Little Big URL Shortener Instalation

Little Big URL Shortener Instalation

#Little Big URL Shortener Instalation#

  • Clone the repo
  • Set up your /etc/hosts and your httpd.conf Mine looks like:
<VirtualHost *:80> 
  DocumentRoot "/home/leandro/public_html/leash" 
  ServerName leash.dev
  <Directory "/home/leandro/public_html/leash"> 
    Options Includes FollowSymLinks 
    AllowOverride All 
    Allow from all 
  </Directory>
</VirtualHost>
  • create a database, enter the mysql console and import the database schema, with a command like (file path is an example): source ~/public_html/leash/bd/bd.sql

  • now you can configure the app options in app/config.yml (auth & cache options don't work yet)

ok, the app should work right now. you can test the rest API accessing the following endpoints:

  • [GET] /0923sdf0s0 → redirects to the original URL
  • [GET] /view/0923sdf0s0 → provides stats info about the short URL
  • [POST] /create/http://google.es → creates the shor url

You can test the GET rest API endpoints with these raw URLs pointing to them directly

Usage

You can find an HTML interface at http://yourdomain.dev/html

There, introduce a canonical URL and via ajax will be shown the shortened URL.

A statistics link for that shortened URL appears also next the shortened URL.

You only can see the stats of a link once that link has been visited one time at least.

Tests

vendor/bin/phpunit Tests/ControllerTest.php --verbose (please, edit the Test class and provide existent data in your database for your own tests)