Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

32 lines (26 sloc) 0.551 kB
require 'sinatra/base'
require 'slim'
class App < Sinatra::Base
set :public, File.dirname(__FILE__) + '/public'
use Rack::Session::Cookie, :key => "sinatra-chat", :secret => "changeme"
helpers do
def current_user
session[:name]
end
end
get "/" do
redirect "/sign_in" unless current_user
slim :homepage
end
get "/sign_in" do
slim :sign_in
end
post "/sign_in" do
session[:name] = params[:name]
redirect "/"
end
get "/sign_out" do
session[:name] = nil
redirect "/"
end
end
Jump to Line
Something went wrong with that request. Please try again.