Giter VIP home page Giter VIP logo

shurl's Introduction

logo

What is shurl?

"shurl" is an elegant backend solution for a customizable URL shortener application. It allows users to generate shortened URLs while providing the option to customize the endpoint, specify its length, and set an expiry time. The application is written in GO and utilizes Redis as a database.

Showcase

Make a shurl to "exampl.com"

// POST "localhost:3000"
{ 
    "url": "example.com" 
}

// Response
{
    "url": "http://example.com",
    "shurl": "localhost:3000/xQ9DC",
    "length": 5,
    "expiry": 0
}

Set custom endpoint

// POST "localhost:3000"
{
    "url": "example.com",
    "shurl": "example"
}

// Response
{
    "url": "http://example.com",
    "shurl": "localhost:3000/example",
    "length": 7,
    "expiry": 0
}

Specifie length of endpoint and set expiry time (in hours)

// POST "localhost:3000"
{
    "url": "example.com",
    "length": 8,
    "expiry": 24
}

// Response
{
    "url": "http://example.com",
    "shurl": "localhost:3000/FpQpLdFN",
    "length": 8,
    "expiry": 24
}

Visiting localhost:3000/xQ9DC, localhost:3000/example or localhost:3000/FpQpLdFN will redirect to exmaple.com

Installation

To build "shurl" and launch server, follow these steps:

  1. Clone and build "shurl":
git clone github.com/axseem/shurl
cd shurl
go build
  1. Set environment variables in ".env" file:
DB_ADDR="localhost:6379"
DB_PASS=""
PORT=":3000"
DOMAIN="localhost${PORT}"
  1. Execute the built application to launch the server:
./shurl

Usage

Here are some enpoints end its methods:

  • / POST <shurl> - Create a shurl
  • /:id GET - Redirect to full URL

License

This project is licensed under the MIT License.

shurl's People

Contributors

axseem avatar

Stargazers

Clayton Kehoe avatar

Watchers

 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.