Last Updated: February 25, 2016
·
1.635K
· supherman

Simple rack app to serve static content

  1. Create a Gemfile

    touch Gemfile
  2. Add the rack gem to the gemfile

    source 'https://rubygems.org'
    
    gem 'rack'
  3. Run bundle install

    bundle install
  4. Create a config.ru file with the following code

    map "/" do
      use Rack::Static, urls: [""],
                        root: File.expand_path('./'),
                        index: 'index.html'
      run lambda {}
    end
  5. Create an index.html file

    touch index.html
  6. Run the server and open your browser at 0.0.0.0:9292

    bundle exec rackup