GithubHelp home page GithubHelp logo

ackuser / url-shortening-service Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 208 KB

Produce a URL shortening service of your own. Think http://bit.ly or http://goo.gl

License: GNU General Public License v2.0

PHP 31.43% HTML 68.57%

url-shortening-service's Introduction

URL-shortening-service

Technical Test Produce a URL shortening service of your own. Think http://bit.ly or http://goo.gl.

It must be built using PHP and MySQL. We would like you to host it at your own URL as well as host the source code in a public GitHub or Bitbucket repository.

You must demonstrate the following;

  1. Knowledge of MVC development.
  2. Ability to follow PSR standards, specifically 0 to 2.
  3. Knowledge of database best practices.
  4. Ability to create simple but effective user interfaces (use of front-end frameworks are acceptable).
  5. Show us DRY, extensible development. (http://en.wikipedia.org/wiki/Don%27t_repeat_yourself) You must avoid using an open source PHP framework, but plugin and open source libraries are acceptable.

Prerequisite

I suppose we already have a basic LAMP environment installed

Clone the project under /var/www

$ cd /var/www
$ git clone [email protected]:ackuser/URL-shortening-service.git

Restart MySQL and Apache

$ /etc/init.d/mysql restart
$ apache2ctl restart

Configure DB

Restore the db from terminal, example

$ cd DumpURLShortServices
$ mysql -u root -p URLss < /URLss_URLShortServices.sql

Check the details of the connection in backend.php and modify it putting your own password if necessary

$servername = "localhost";
$username = "root";
$password = '';
$dbname = "URLss";

Usage

Check it online

go to (http://localhost/URL-shortening-service)

Then you can insert a long url, as long as you want to make it shorter

See screenshot

Settings Window

NOTE: For simplicity I didn't parse some errors we can get back, neither I put the configuration of the domain nor Database with more than one table (not in the requirements). I am also sending back to the client all the data from the db.

Testing only backend

Post request with data

$ curl 'http://localhost/URL-shortening-service/backend.php' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' --data 'url=http://testingreallylongislikethis.com'

NOTE: use a different url in the curl each time you are testing only backend.

Next release, suggestions:

  • PHPUnit
  • Composer
  • Pagination
  • Plugin
  • More PSR standards oriented
  • Parser errors
  • Apache configuration for a LAMP environment
  • Apache Virtual Host configuration for our domain

url-shortening-service's People

Contributors

ackuser avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.