Sinatra is much better than rails for writing API codes and small functionalities, We can run sinatra app inside rails application.
Write your sinatra codes inside library folder of rails application, you can call rails application database tables from sinatra app also.
Then on your rails app config.ru
# This file is used by Rack-based servers to start the application.
require ::File.expand_path(‘../config/environment’, __FILE__)
map ‘/api’ do
map ‘/’ do
Put this code, so normal request goes to rails controller and request url with /api goes to sinatra app. This way we can use both rails app and sinatra app together.