Last active
February 4, 2024 21:54
-
-
Save skyjia/3809536 to your computer and use it in GitHub Desktop.
Sinatra with Redis Session
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" | |
require "sinatra/reloader" | |
require "redis-store" | |
require 'redis-rack' | |
class ApplicationController < Sinatra::Base | |
configure :development do | |
register Sinatra::Reloader | |
end | |
use Rack::Session::Redis, :redis_server => 'redis://127.0.0.1:6379/0' | |
get '/:pass' do | |
session[:pass] = params[:pass] | |
"Session: " + session[:pass] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment