We build a Link Shortener Web Application in Ruby on Rails 6.
URL Shortener is a free tool to shorten a URL or reduce a link and making it easy to remember.
- Ruby on Rails
We are going to build the web application using:
- Rails 6.0.3.3
- Ruby 2.7.1
$ git clone https://github.com/TanHongIT/Rails_Shortener_URL_Project
$ cd Rails_Shortener_URL_Project
$ bundle install
$ yarn install
You must change the appropriate database configuration
Change configuration at "config/database.yml" with Postgresql.
default: &default
adapter: postgresql
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout: 5000
username: rails_shortener_url_project
password: 1974
host: localhost
# tutorial for ubuntu linux:
# sudo -u postgres psql
# create user "rails_shortener_url_project" with password '1974';
# create database "rails_shortener_url_project" owner "rails_shortener_url_project";
development:
<<: *default
database: rails_shortener_url_project
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default
database: rails_shortener_url_project_test
production:
<<: *default
database: rails_shortener_url_project_production
You must change the username, password and database name accordingly!
$ rails db:migrate
$ rails db:migrate RAILS_ENV=development
$ rails db:migrate RAILS_ENV=test
$ rails s
Now, go to http://localhost:3000/
Support this project 😜 🙏