Backend project using Ruby On Rails + PostgreSQL
To build the project, run the command:
docker-compose build
this will build the necessary containers for the Application and Database
To bring the Rails App up, run the command:
docker-compose up
You should be able to access the app through the URL http://localhost:4000
.
To create and set up the database, just run the following command:
docker-compose run web rake db:create db:setup
this will create both development database and test database
To run the application specs, run the commaand:
docker-compose run web rake
To short urls the project uses a conversion from base10 to base62, using the ID generated by database to create the url_code
. It's is a simple algorithm and could be seen inside app/services/url_shortener.rb
, and tested in spec/services/url_shortener_spec.rb
.
The app is hosted on AWS Beanstalk, working inside a Ruby2.7.1 enviroment
App link: http://shortenedurlapi-env.eba-hmyteghu.sa-east-1.elasticbeanstalk.com/