GithubHelp home page GithubHelp logo

ursho's Introduction

Synopsis

URL Shortener Service

Run

Run with Docker

docker-compose up

Code Example

Using CURL Generate shortener\

$ curl -H "Content-Type: application/json" -X POST -d '{"url":"www.google.com"}' http://localhost:8080/encode/
<!-- Response: -->
<!-- {"success":true,"response":"http://localhost:8080/1"} -->

Redirect Open url in your browser http://localhost:8080/bN

OR

curl http://localhost:8080/1

Get info for url shortener
curl http://localhost:8080/info/1

Response:

{
 "success":true,
 "response": {
    "url":"www.google.com",
    "visited":true,
    "count":1
 }
}

Motivation

..

Installation

You can install it using 'go get' or cloning the repository.

Use go get

# fetches the program
go get github.com/douglasmakey/ursho

# move to the app's directory
cd $GOPATH/src/github.com/douglasmakey/ursho

Cloning the repo

We'll use github.com/user as our base path. Create a directory inside your workspace in which to keep source code:

mkdir -p $GOPATH/src/github.com/douglasmakey cd "$_"

Clone repository or download and unrar in folder
git clone https://github.com/douglasmakey/ursho.git

Use GLIDE Package Management for Golang, for installation all packages

https://github.com/Masterminds/glide

Run glide install in the folder.

Select method of persistence

select the method of persistence, in which you going to work.
storage := &storages.Postgres{}

If selected Postgresql as Storage, create database

CREATE DATABASE ursho_db;

Add your config for the method of persistence and other options in file config.json\

{
  "server": {
    "host": "0.0.0.0",
    "port": "8080"
  },
  "options": {
    "prefix": "http://localhost:8080/"
  },
  "posgres": {
    "user": "postgres",
    "password": "mysecretpassword",
    "db": "ursho_db"
  }
}

API Reference

..

Tests

..

Contributors

..

License

A short snippet describing the license (MIT, Apache, etc.)

ursho's People

Contributors

campoy avatar douglasmakey avatar ebastos avatar foadyousefi avatar matiasinsaurralde 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.