Skip to content

Instantly share code, notes, and snippets.

@mayfer
Created November 14, 2014 19:57
Show Gist options
  • Save mayfer/ea3d6a9900adf1bdede1 to your computer and use it in GitHub Desktop.
Save mayfer/ea3d6a9900adf1bdede1 to your computer and use it in GitHub Desktop.
Basic HTTP get/post example setup with sinatra
<!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>
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