struct

Orion::Router

Inherits Struct < Value < Object

The Orion::Router is the workhorse that does the work when a request comes into your application. It will take all of your defined routes and builds you an application that can serve HTTP traffic. You can configure the router using the config in a single file router. Or by calling the new or start method within your app.

Constructors

new(tree : DSL::Tree, autoclose : Bool = true)
Source

Class methods

start(tree : DSL::Tree, autoclose : Bool = true, workers = nil, **bind_opts)
Source

Instance methods

bind(*, tls : Nil = nil, uri)

Bind using a URI

Source

Bind TLS with an address

Source
bind(*, tls : OpenSSL::SSL::Context::Server, host = ::Socket::IPAddress::LOOPBACK, port = nil, reuse_port = false)

Bind TLS with a host and port

Source
bind(*, tls : Nil = nil, host = ::Socket::IPAddress::LOOPBACK, port = nil, reuse_port = false)

Bind TCP to a host and port

Source
bind(*, tls : Nil = nil, address : Socket::IPAddress, reuse_port = false)

Bind TCP to a Socket::IPAddress

Source
bind(*, tls = nil, address : Socket::UNIXAddress)

Bind to a Socket::UnixAddress

Source
bind(*, tls = nil, path)
Source
bind(*, config : Orion::Config)

Bind using a config

Source
call(*args, **options)
Source
call(*args, **options, &)
Source
handlers
Source
listen(*, workers, **opts)

Listen clients using multiple workers A good suggestion is to use System.cpu_count

Source
listen(*args, prefix = self.class.name, **opts)

Listen for clients

Source
request_processor
Source
use(handler : HTTP::Handler)
Source
use(handler)
Source
visualize

Visualize the route tree

Source