Sinatra minimal service

less than 1 minute read

 
# Sinatra example for simple webservice.
# Sort lines in a file and return it. 
require 'rubygems'
require 'sinatra'

post '/sorter' do
  params[:data][:tempfile].readlines.sort
end
# test service with this command
# curl -F "data=@sa.txt" 127.0.0.1:4567/sorter
 

Updated: