Skip to content

abruzy/url-shortener

Repository files navigation

Contributors Forks Stargazers Issues MIT License


URL Shortener

Link to live Version of the app

This app helps you shortens your long urls
Explore the docs �

Table of Contents

About The Project

There are several services and some platforms providing URL shortener. Sometimes they call it link shortener, URL shrinker, Link compressor, vanity URL creator, but they all work the same:

  • You enter a URL and the output is a short URL.
  • You can use that short URL for example for social media sharing.
  • When users click on the short link they are getting redirected to your origin URL.
  • You can see stats about clicks on your links.

Some services provide a Custom URL shortener, so that you can register your domain and use that domain to shrink your URLs. Using your domain can create more trust for the ones who see the link.

The benefit of using such a service is that you will be able to track down clicks on links you are sharing on social media. The disadvantage is that you rely on third party services and if you can see the statistics of your clicks, the service will also do.

That's why we want to implement our Link shortener in Ruby On Rails.

Built With

This progam was made using this technologies

Getting Started

To get a local copy up and running follow these simple example steps.

Prerequisites

  • Ruby You can easily install Ruby on your Linux computer by using Homebrew and Chruby
brew install chruby
brew install ruby-install
ruby-install ruby
  gem install rails

Installation

  1. Clone the repo
git clone git@github.com:abruzy/url-shortener.git
  1. The next thing is to change directory folder
cd url-shortener
  1. The next step is to install our dependencies by running the following command below
bundle install
yarn install
  1. create a file called '.env' in your root directory and copy the field below and paste it inside that .env file

NB: please replace, for example 'yourpassword' to 'abruzy9463' with the appropiate details

DATABASE_NAME='yourdatabasename'
TEST_DATABASE_NAME='yourtestdatabasename'
DATABASE_USER='yourpostgresuser'
DATABASE_PASSWORD='yourpassword'
DATABASE_HOST='yourpostgreshost'
DATABASE_PORT='yourportnumber'
  1. The next step is to run the command below

NB: please make sure you have pgadmin installed on your machine

rails db:create
  1. The next step is to migrate to our database by running the following command
rails db:migrate
  1. Voila!!, you did a great job but alas, we need to complete the whole step by actually starting our server by running the command below
rails s
  1. Now to view the app, we need to visit this url below and you can actually see this in your terminal when you start the server
http://localhost:3000/

To run test

rspec

Usage

To create a short link, do the following

Open your POST Man

NB: Make sure it is set to POST

Open your chrome browser and do this

  http://localhost:3000/api/v1/:slug

where there's :slug, please replace it with the one you input when creating it and hit enter

This will take you back to your original site and voila, that's it

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Project Link: https://github.com/abruzy/url-shortener

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published