Class: Requestkit::Server
- Inherits:
-
Object
- Object
- Requestkit::Server
- Defined in:
- lib/requestkit/server.rb,
lib/requestkit/server/render.rb,
lib/requestkit/server/request.rb
Defined Under Namespace
Instance Method Summary collapse
-
#initialize(config) ⇒ Server
constructor
A new instance of Server.
- #start ⇒ Object
Constructor Details
#initialize(config) ⇒ Server
Returns a new instance of Server.
15 16 17 18 19 20 |
# File 'lib/requestkit/server.rb', line 15 def initialize(config) @config = config @port = config.port @db = Storage.new(config) @clients = [] end |
Instance Method Details
#start ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/requestkit/server.rb', line 22 def start puts "📦 Requestkit starting on http://localhost:#{@port}" puts "Press Ctrl+C to stop" endpoint = Async::HTTP::Endpoint.parse("http://localhost:#{@port}") Async do Async::HTTP::Server.new(method(:route), endpoint).run end end |