module StackMob::CLI::LocalServer

Constants

DEFAULT_PORT

Public Instance Methods

start_local_server(port = DEFAULT_PORT, path_root = '.') click to toggle source
# File lib/stackmob/cli/local_server.rb, line 43
def start_local_server(port = DEFAULT_PORT, path_root = '.')
  app = ::Rack::Builder.new do 
    use StackMob::Middleware::Proxy
    use StackMob::Middleware::Rewrite

    endpoint = ::Rack::Static.new lambda { |e| [] }, :urls => ['/'], :root => path_root
    map "/" do 
      run endpoint
    end
  end.to_app        
  Server.start :app => app, :host => '0.0.0.0', :server => 'thin', :Port => port
end