Created
August 22, 2014 17:16
-
-
Save mayfer/5ae4c63130fd366c9d73 to your computer and use it in GitHub Desktop.
A simple example demonstrating sending POST data from an HTML form
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
get '/' do | |
<<-eos | |
<html> | |
<head> | |
<title>coffee orbit</title> | |
</head> | |
<body> | |
<form method='post' action='/new_message'> | |
Message: <input type='text' name='message' /> | |
<input type='submit' name='Send' /> | |
</form> | |
</body> | |
</html> | |
eos | |
end | |
post '/new_message' do | |
"you sent: #{params[:message]}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment