/lilliput

Jabong's Url Shortener

Primary LanguageGoMIT LicenseMIT

lilliput

Jabong's Url Shortener

Status

HOW TO INSTALL GOLANG

  1. Download the archive from here
  2. Go to the folder containing downloaded file using terminal
  3. Extract the file into /usr/local,creating a go tree in /usr/local/go by typing
    tar -C /usr/local -xzf go$VERSION.$OS-$ARCH.tar.gz
    For example if you are installing Go version 1.2.1 for 64-bit x86 on Linux.
    tar -C /usr/local -xzf go1.2.1.linux-amd64.tar.gz
  4. Add environment variables in .bashrc file
    1. Go to $HOME direcitory by typing
      cd
    2. Open .bashrc file
      vi .bashrc
    3. Place these lines in the end of the file(.bashrc)
      export GOROOT=/usr/local/go
      export GOPATH=$HOME/lilliput
      export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
      export PATH=$PATH:$GOPATH/bin
    4. Save and exit the file. Press "Esc" and then :wq
    5. Source the .bashrc file
      source .bashrc 
  5. Test your installation by typing
    go version

HOW TO INSTALL LILLIPUT

  • Fork the repository by clicking the "Fork" button in the GitHub.com repository(apiary).
  • Clone your forked repo in $HOME
    git clone https://github.com/jabong/lilliput
  • Crete branches to build new features and test out ideas
    git branch "branchname"
    git checkout "branchname"
    Alternatvely we can use
    git checkout -b "branchname"
  • Deploy dependencies. Go to the directory $HOME/lilliput and type
    make depends
  • To build apiary executable file type
    make build
  • Configuration:
  • Copy config.ini to dev.ini and change values as per your environment
  • 	
    			[lilliput]
    			// port number on which lilliput will be running
    			port = 8989 
    			// domain name which will be prepend in tinyurl
    			domain = "http://jbo.ng/"
    			[redis]
    			server = "127.0.0.1"
    			port = "6379"
    			dbname = 0
    	
    

    Documents

    Sample Usage

    	
    		shell> curl --data "url=http://google.com" http://jbo.ng/
    	
    
    Output
    	{
    	  "url": "http://jbo.ng/vmePlru",
    	  "err": false,
    	  "message": ""
    	}