Reputation: 151046
I followed the instruction to do
gem install puma
puma
but it can't start a webserver, and is supposed to look for config.ru
. Must Puma be run with Rack and Rails? Can Puma be run as a standalone webserver?
Upvotes: 1
Views: 678
Reputation: 11
Yes. Sort of.
You do not have to have the rack gem installed, if that's what you are wondering. But perhaps that's because Puma contains it's own rack builder/handler.
https://medium.com/@lfv89/rackless-ruby-servers-why-not-a9f8430067dd
Here's the actual code snippet:
/puma-5.1.1/lib/puma/configuration.rb:328
begin
require 'rack'
require 'rack/builder'
rescue LoadError
# ok, use builtin version
return Puma::Rack::Builder
else
return ::Rack::Builder
end
Upvotes: 1
Reputation: 102154
Is it possible to run Puma as a webserver without rack?
No.
Puma like Thin and Unicorn is a Rack server. Rack is just really a basic common gateway interface and I can't really see why you would want to build any sort of web application in Ruby without using Rack unless you want to build a server from scratch out of curiosity.
Building a basic hello world app with rack is trivial:
# config.ru
run ->(env) { [200, {"Content-Type" => "text/html"}, ["Hello World!"]] }
Must Puma be run with Rack and Rails?
Rails is not a requirement for any Rack server that I know of.
Upvotes: 1