Sha256: 176c00decbc38c0a5ecc3e364e93b92ae7f652c478249dcf2fc0d68b1fc6b694
Contents?: true
Size: 1.2 KB
Versions: 3
Compression:
Stored size: 1.2 KB
Contents
#!/usr/bin/env rackup -p 4000 -s thin # encoding: utf-8 require "rango" Rango.boot use Rango::Middlewares::Basic # rack-router Rango::Router.use(:rack_router) use Rack::Router do |router| # with(to: Twitter) do router.map "/:action", to: Twitter router.map "/login", to: Twitter, action: :login, name: :login router.map "/logout", to: Twitter, action: :logout, name: :logout router.map "/signup", to: Twitter, action: :signup, name: :signup router.map "/", to: Twitter, action: :index, name: :index router.map "/:id", to: Twitter, action: :timeline, name: :timeline, conditions: {id: /^\d+$/} # end end # reload code when something changed use Rack::Reloader # warden authentication # wiki.github.com/hassox/warden/setup require "warden" Project.import("views.rb") use Warden::Manager do |manager| manager.default_strategies :password manager.failure_app = Twitter end Warden::Manager.serialize_into_session { |user| user.id } Warden::Manager.serialize_from_session { |key| User.get(id) } # Go to login Warden::Manager.before_failure do |env, opts| Twitter.route_to env, 'login' end Warden::Strategies.add(:password) do def authenticate! User.new end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rango-0.0.6 | examples/twitter/config.ru |
rango-0.1.pre | examples/twitter/config.ru |
rango-0.0.4 | examples/twitter/config.ru |