Skip to content

Instantly share code, notes, and snippets.

@mghaught
Created March 18, 2011 16:39
Show Gist options
  • Save mghaught/876394 to your computer and use it in GitHub Desktop.
Save mghaught/876394 to your computer and use it in GitHub Desktop.
nps sinatra app
require 'rubygems'
require 'sinatra/base'
require 'haml'
class NetPromoterScoreApp < Sinatra::Base
before do
headers "Content-Type" => "text/html; charset=utf-8"
end
get '/' do
haml :index
end
get '/projects/new' do
haml :new_project
end
# create new project
post '/projects' do
"Create new project"
end
get '/project/:project_key' do
"Found project for #{params[:project_key]}"
end
# edit project
get '/project/:project_key/edit' do
"Editing project for #{params[:project_key]}"
end
# update project
put '/project/:project_key' do
"Updated #{params[:project_key]} "
end
get '/scores/new' do
"Would you recommend this service to a friend?"
end
post '/scores' do
"crunching score data"
redirect to('/scores/follow-up')
end
get '/scores/follow-up' do
"Now a follow up question"
end
post '/scores/follow-up' do
"Thank you!"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment