Skip to content

Instantly share code, notes, and snippets.

@kinnalru
Created February 25, 2021 08:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kinnalru/7fd5ba10e81ec109de3dfe29a1e4a78d to your computer and use it in GitHub Desktop.
Save kinnalru/7fd5ba10e81ec109de3dfe29a1e4a78d to your computer and use it in GitHub Desktop.
StartWebrick
class StartWebrick < Base
def start
server = WEBrick::HTTPServer.new Host: '0.0.0.0', Port: @port, MaxClients: 3000, ShutdownSocketWithoutClose: true, Logger: Logger.new(IO::NULL), AccessLog: []
server.mount_proc('/') { |req, res| res.body = 'hello' }
server.start
end
def stop(pid)
Process.kill("KILL", pid)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment