Link to live Version of the app
This app helps you shortens your long urls
Explore the docs �
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.
This progam was made using this technologies
To get a local copy up and running follow these simple example steps.
brew install chruby
brew install ruby-install
ruby-install ruby
- Rails You can easily install Rails by using the odin project's giude or directly from the rails site
gem install rails
- Clone the repo
git clone git@github.com:abruzy/url-shortener.git
- The next thing is to change directory folder
cd url-shortener
- The next step is to install our dependencies by running the following command below
bundle install
yarn install
- 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'
- The next step is to run the command below
NB: please make sure you have pgadmin installed on your machine
rails db:create
- The next step is to migrate to our database by running the following command
rails db:migrate
- 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
- 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/
rspec
To create a short link, do the following
Open your POST Man
NB: Make sure it is set to POST
-
then set your params accroding to the screenshot above!
-
After creating the short url, you can confirm using the instructions below
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
See the open issues for a list of proposed features (and known issues).
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.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.
- Abubarkar Diallo: Github
Project Link: https://github.com/abruzy/url-shortener