Module: Twenty::Servlet::ServerMixin

Included in:
Twenty::Servlet
Defined in:
lib/twenty-backend/servlet/mixin/server_mixin.rb

Instance Method Summary collapse

Instance Method Details

#server(options = {}) ⇒ WEBrick::HTTPServer

Returns an instance of WEBrick::HTTPServer.

Parameters:

Returns:

  • (WEBrick::HTTPServer)

    Returns an instance of WEBrick::HTTPServer.



11
12
13
14
15
# File 'lib/twenty-backend/servlet/mixin/server_mixin.rb', line 11

def server(options = {})
  server = WEBrick::HTTPServer.new server_options.merge(options)
  server.mount "/graphql", Twenty::Servlet::GraphQL
  server
end

#server_optionsHash<Symbol, String>

Returns The default server options given to WEBrick::HTTPServer.new.

Returns:

  • (Hash<Symbol, String>)

    The default server options given to WEBrick::HTTPServer.new.



20
21
22
23
24
25
26
# File 'lib/twenty-backend/servlet/mixin/server_mixin.rb', line 20

def server_options
  {
    DocumentRoot: Twenty.build,
    BindAddress: "127.0.0.1",
    Port: 2020
  }
end