Skip to content

CesarOliveira/uri-shortener

Repository files navigation

Shortener

Live Example

You can check here the live exemplo: http://shortener.cesaroliveira.com.br/

Prerequisites

Bulding the Application

First you need to up the docker application with:

docker-compose up -d

In the first time all the images will be builded.

After that you need to create the databse:

docker exec -it api-shortener rake db:create db:migrate

If you want, you can populate the database with:

docker exec -it api-shortener rake db:seed

Configure in your /etc/hosts file the entries for a better experience

127.0.0.1 api-shortener.local
127.0.0.1 client-shortener.local

Now just access: http://client-shortener.local/ or http://localhost:8080/ if you not configured the hosts above

Using the API

Creating the First Link with CURL

A curl example to create a new shortened link:

curl --location --request POST 'http://localhost:3001/api/links' \
--header 'Content-Type: application/json' \
--data-raw '{
    "link": {
    "destination_url": "http://gmail.com.br"
    }
}'

I also add in this repository the Shortener.postman_collection.json file that you can import in Postman app and see all the routes available.

Tip: How to import a collection in Postman: https://www.youtube.com/watch?v=hMbF3fZitic

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published