This project is practice, for me to learn using Ruby with Sinatra to build a simple API.
The assignment that I'm following is described in ASSIGNMENT.md
.
The project is implemented using Sinatra, a domain-specific language created for Ruby, to allow people to create web applications quickly. For the datastore, I'm using SQLite. I also do automated testing using RSpec.
- Clone Git repo
- Run
bundle install
- Run
bundle exec rackup
API Endpoint: POST /encode
POST Request message:
{
"url": "https://codesubmit.io/library/react"
}
Example:
curl -i -X POST http://localhost:4567/encode -H "Content-Type: application/json" -d "{\"url\":\"https://codesubmit.io/library/react\"}"
API Endpoint: POST /decode
POST Request message:
{
"short_url": "https://short.est/GeAi9K"
}
Example:
curl -i -X POST http://localhost:4567/decode -H "Content-Type: application/json" -d "{\"short_url\":\"https://short.est/123\"}"