Created
November 14, 2014 19:57
-
-
Save mayfer/ea3d6a9900adf1bdede1 to your computer and use it in GitHub Desktop.
Basic HTTP get/post example setup with sinatra
This file contains 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
<!doctype html> | |
<html> | |
<head> | |
<title>hmmm</title> | |
<style> | |
html, body { background: #377; font-family: monospace; color: #fff; } | |
</style> | |
</head> | |
<body> | |
<h1>some sort of text</h1> | |
<form action="/whodat" method='post'> | |
<input type='text' name='who_bby_dis' /> | |
<input type='text' name='who_bby_dat' /> | |
<input type='submit' name='button' value='Submit' /> | |
</form> | |
</body> | |
</html> |
This file contains 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' | |
set :views, Proc.new { File.dirname(__FILE__) } | |
get '/' do | |
erb :index | |
end | |
post '/whodat' do | |
"response page, you sent: #{params[:button]}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment