GithubHelp home page GithubHelp logo

url-shortener's Introduction

url-shortener

Url Shortener Using Slim php framework

##Description This is a microservice to demo how Url shortener could work using PHP Slim framework and SQLite for storage

##Requirements

  • SQlite version >= 3.14.2
  • php version >= 7.0.0
  • Composer

Running

Dependencies 
   From the application root, run composer install

Migration
    From the application root, run ./config/migations/migrate.sh

Server
   From the application root, run php -S localhost:9000 -t src src/index.php

Unit Tests Only
   From the application root, run ./vendor/bin/phpunit --colors ./test

Integrated Tests Only
   From application root cd test/Integration, then run ./../../vendor/bin/behat 

Unit and Integrated tests together
   From application root, run ./run-tests.sh 

Not Doing

    - Not validating Urls in terms of reachability or that there are indeed Urls

Example Usage

     Shorten and save a Url (Create/Replace)
       PUT /api/urls/{urlEncodedTargetUrl} (/api/urls/https%3A%2F%2Fwww.facebook.com%2F) 
        Optional body: 
        {"devices": {"mobile": "https://m.facebook.com/"}}
     
     Retrive saved Url 
        GET /api/urls/{urlEncodedTargetUrl} (/api/urls/https%3A%2F%2Fwww.facebook.com%2F)
        
     Delete saved Url 
        DELETE /api/urls/{urlEncodedTargetUrl} (/api/urls/https%3A%2F%2Fwww.facebook.com%2F)
        
     Retrive All saved Urls
        GET /api/urls
        
     Redirect to target by visiting shortened url
         GET|POST|PUT|DELETE|PATCH /{shortenedString} (/1a3rty)  

url-shortener's People

Contributors

ezinelony avatar

Watchers

 avatar  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.