Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# file: rest-server.rb
require 'sinatra'
# all status codes given are based on W3C standards
get '/' do
'Here is some data.'
end
post '/' do
puts "Data: '#{params[:foo]}' recieved, creating object."
status 201
end
put '/' do
puts "Data: '#{params[:foo]}' recieved, updating object."
end
delete '/' do
puts 'Deleting data.'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment