Last active
December 16, 2015 05:08
-
-
Save digitalextremist/5381722 to your computer and use it in GitHub Desktop.
Test application for Reel::Request::Parser abstraction layer.
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
MU_BASE = File.expand_path( File.dirname( __FILE__ ) ) | |
require 'rubygems' | |
require "bundler/setup" | |
REEL_PARSER = :puma_http11 | |
require ( REEL_LIB = ( LIB_BASE = "/mu/tweaking" ) + "/reel/lib/" ) + 'reel/app' | |
require 'rack' | |
require 'rack/request' | |
require 'rack/multipart' | |
class Wu | |
include Reel::App | |
get '/' do |request| | |
[200, {}, "<a href='/uploader.html'>Upload Files</a>"] | |
end | |
get '/uploader.html' do |request| | |
[ 200, {}, IO.binread( MU_BASE + "/public/uploader.html" ) ] | |
end | |
get '/uploader.js' do |request| | |
[ 200, {}, IO.binread( MU_BASE + "/public/uploader.js" ) ] | |
end | |
get '/uploader.swf' do |request| | |
[ 200, {}, IO.binread( MU_BASE + "/public/uploader.swf" ) ] | |
end | |
post '/uploading' do |request| | |
params = Rack::Request.new(request.env).params | |
File.open("/mu/test-reel/uploads/" + params["file"][:filename], 'w') {|f| f.write( params["file"][:tempfile].read ) } | |
[200, {}, ""] | |
end | |
end | |
Wu.new( '0.0.0.0', 99 ) | |
puts "Testing Octarine server, provided by Reel //" | |
sleep |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment