Module: Sora
- Defined in:
- lib/sora.rb,
lib/sora/version.rb
Overview
sora module
Defined Under Namespace
Classes: Error
Constant Summary collapse
- VERSION =
"24.8.4"
Class Method Summary collapse
Class Method Details
.server(port: 8080, document_root: "./") ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/sora.rb', line 12 def server(port: 8080, document_root: "./") srv = WEBrick::HTTPServer.new( { DocumentRoot: document_root, BindAddress: "0.0.0.0", Port: port, CGIInterpreter: RbConfig.ruby, DoNotReverseLookup: true } ) srv.mount("/cgi-bin", WEBrick::HTTPServlet::CGIHandler, "#{document_root}/../cgi-bin/main.rb") srv.mount("/get", WEBrick::HTTPServlet::CGIHandler, "#{document_root}/../cgi-bin/get.rb") srv.mount("/", WEBrick::HTTPServlet::FileHandler, "#{document_root}/index.html") srv.mount("/style", WEBrick::HTTPServlet::FileHandler, "#{document_root}/style.css") srv.mount("/js", WEBrick::HTTPServlet::FileHandler, "#{document_root}/bundle.js") trap("INT") { srv.shutdown } srv.start end |