How to use sinatra session

前端 未结 2 1165
野的像风
野的像风 2021-02-08 20:50
enable :sessions
get \'/foo\' do
  session[\'m\'] = \'Hello World!\'
  redirect \'/bar\'
end

get \'/bar\' do
  session[\'m\']   # => \'Hello World!\'

end

2条回答
  •  难免孤独
    2021-02-08 21:13

    Are you using shotgun? If so, do the following:

    configure(:development) { set :session_secret, "something" }
    

    This will no longer be necessary in Sinatra 1.3.

提交回复
热议问题