Skip to content

Instantly share code, notes, and snippets.

@skyjia
Last active February 4, 2024 21:54
Show Gist options
  • Save skyjia/3809536 to your computer and use it in GitHub Desktop.
Save skyjia/3809536 to your computer and use it in GitHub Desktop.
Sinatra with Redis Session
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