Small web framework for writing simple JSON APIs. Based on Rack.
git clone [email protected]:madeinussr/trial.git
Define actions in the config.ru
file:
# config.ru
require 'trialday'
get '/bla' do
{ results: [1, 2, 3] }
end
post '/bla' do |params|
name = params[:name]
{ name: name }
end
Start the server:
bundle exec rackup --port 3000
Make requests:
curl http://localhost:3000/bla -i
curl -XPOST http://localhost:3000/bla -i -H "Content-Type: application/json" -d '{"name": "Mario"}'
bundle exec rspec