Sha256: 5281543ab6105c9376f2fbdd6f2287987a5e7fa976cb3a686e28a30aad168b45
Contents?: true
Size: 695 Bytes
Versions: 34
Compression:
Stored size: 695 Bytes
Contents
require 'sinatra/base' require 'opentok' raise "You must define API_KEY and API_SECRET environment variables" unless ENV.has_key?("API_KEY") && ENV.has_key?("API_SECRET") class HelloWorld < Sinatra::Base set :api_key, ENV['API_KEY'] set :opentok, OpenTok::OpenTok.new(api_key, ENV['API_SECRET']) set :session, opentok.create_session get '/' do api_key = settings.api_key session_id = settings.session.session_id token = settings.opentok.generate_token(session_id) erb :index, :locals => { :api_key => api_key, :session_id => session_id, :token => token } end # start the server if ruby file executed directly run! if app_file == $0 end
Version data entries
34 entries across 34 versions & 1 rubygems