Skip to content

Instantly share code, notes, and snippets.

@v-kolesnikov
Created May 23, 2020 09:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save v-kolesnikov/111144e4ca12850b06921c1d7bd18336 to your computer and use it in GitHub Desktop.
Save v-kolesnikov/111144e4ca12850b06921c1d7bd18336 to your computer and use it in GitHub Desktop.
Single file Rails app
# frozen_string_literal: true
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'rails', '~> 6.0'
end
require 'action_controller/railtie'
require 'logger'
Rails.logger = Logger.new(STDOUT)
class App < ::Rails::Application
routes.append do
root to: 'root#index'
end
end
class RootController < ActionController::Base
def index
render plain: Rails.version
end
end
App.initialize!
Rack::Server.start(app: App)
single-file-app λ ruby app.rb
config.eager_load is set to nil. Please update your config/environments/*.rb files accordingly:
* development - set it to false
* test - set it to false (unless you use a tool that preloads your test environment)
* production - set it to true
[2020-05-23 12:07:13] INFO WEBrick 1.6.0
[2020-05-23 12:07:13] INFO ruby 2.7.1 (2020-03-31) [x86_64-darwin19]
[2020-05-23 12:07:13] INFO WEBrick::HTTPServer#start: pid=5201 port=8080
I, [2020-05-23T12:07:16.030507 #5201] INFO -- : Started GET "/" for ::1 at 2020-05-23 12:07:16 +0300
I, [2020-05-23T12:07:16.032118 #5201] INFO -- : Processing by RootController#index as */*
I, [2020-05-23T12:07:16.034307 #5201] INFO -- : Rendering text template
I, [2020-05-23T12:07:16.034404 #5201] INFO -- : Rendered text template (Duration: 0.0ms | Allocations: 3)
I, [2020-05-23T12:07:16.034523 #5201] INFO -- : Completed 200 OK in 2ms (Views: 2.3ms | Allocations: 876)
::1 - - [23/May/2020:12:07:16 MSK] "GET / HTTP/1.1" 200 7
- -> /
single-file-app λ http http://localhost:8080
HTTP/1.1 200 OK
Cache-Control: max-age=0, private, must-revalidate
Connection: Keep-Alive
Content-Length: 7
Content-Type: text/plain; charset=utf-8
Date: Sat, 23 May 2020 09:08:13 GMT
Etag: W/"5f7f4155aa954924e378228198cce1ff"
Referrer-Policy: strict-origin-when-cross-origin
Server: WEBrick/1.6.0 (Ruby/2.7.1/2020-03-31)
X-Content-Type-Options: nosniff
X-Download-Options: noopen
X-Frame-Options: SAMEORIGIN
X-Permitted-Cross-Domain-Policies: none
X-Request-Id: b3a611f8-2a2c-4c80-872a-11fc534a8cc5
X-Runtime: 0.001231
X-Xss-Protection: 1; mode=block
6.0.3.1
single-file-app λ
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment