Sha256: 1e11797a6cd3af2a55bb9d9c8bb589e5dc3839f59f8aa36df90601139e5d5868
Contents?: true
Size: 1.27 KB
Versions: 2
Compression:
Stored size: 1.27 KB
Contents
# config.ru require 'bundler' Bundler.require require "react/source" Opal::Processor.source_map_enabled = true opal = Opal::Server.new {|s| s.append_path './' s.append_path File.dirname(::React::Source.bundled_path_for("react-with-addons.js")) s.main = 'example' s.debug = true } map opal.source_maps.prefix do run opal.source_maps end map '/assets' do run opal.sprockets end get '/comments.json' do comments = JSON.parse(open("./_comments.json").read) JSON.generate(comments) end post "/comments.json" do comments = JSON.parse(open("./_comments.json").read) comments << JSON.parse(request.body.read) File.write('./_comments.json', JSON.pretty_generate(comments, :indent => ' ')) JSON.generate(comments) end get '/' do <<-HTML <!doctype html> <html> <head> <title>Hello React</title> <link rel="stylesheet" href="base.css" /> <script src="https://code.jquery.com/jquery-2.1.3.min.js"></script> <script src="http://cdnjs.cloudflare.com/ajax/libs/showdown/0.3.1/showdown.min.js"></script> <script src="/assets/react-with-addons.js"></script> <script src="/assets/example.js"></script> </head> <body> <div id="content"></div> </body> </html> HTML end run Sinatra::Application
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
react.rb-0.2.1 | example/react-tutorial/config.ru |
react.rb-0.2.0 | example/react-tutorial/config.ru |