al-quran.reflectslight.io/packages/ruby/server
2024-02-18 09:26:04 -03:00
..
lib server: fix cache bust 2023-07-09 02:16:55 -03:00
test server: add gzip support 2023-06-29 12:37:50 -03:00
.gitignore Add packages/ruby/server/ (#132) 2023-06-25 21:03:07 -03:00
.rubocop.yml server: add gzip support 2023-06-29 12:37:50 -03:00
Gemfile Add packages/ruby/server/ (#132) 2023-06-25 21:03:07 -03:00
LICENSE Add packages/ruby/server/ (#132) 2023-06-25 21:03:07 -03:00
README.md Add packages/ruby/server/ (#132) 2023-06-25 21:03:07 -03:00
server.rb.gemspec Add per-env webpack configuration files 2024-02-18 09:26:04 -03:00

About

server.rb implements a static file web server by using the fast performing Ruby web server Puma and a small Rack application.

Examples

Server.for_dir

The Server.for_dir method returns a Server instance that serves the contents of a directory. Server#start spawns a new thread to listen for requests, and afterwards returns the thread. Thread#join can block execution at that point, or execution can continue as normal by not calling Thread#join:

require "server"

##
# Create a Server instance for the contents of a directory
server = Server.for_dir("./build/website/")

##
# Start listening for connections
thr = server.start

##
# Prevent the main thread from exiting
thr.join

License

BSD Zero Clause.
See LICENSE.