struct Orion::Router

Overview

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.

Defined in:

orion/router.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(tree : DSL::Tree, autoclose : Bool = true) #

[View source]

Class Method Detail

def self.start(tree : DSL::Tree, autoclose : Bool = true, workers = nil, **bind_opts) #

[View source]

Instance Method Detail

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

Bind using a URI


[View source]
def bind(*, tls : OpenSSL::SSL::Context::Server, address : Socket::IPAddress) #

Bind TLS with an address


[View source]
def bind(*, tls : OpenSSL::SSL::Context::Server, host = ::Socket::IPAddress::LOOPBACK, port = nil, reuse_port = false) #

Bind TLS with a host and port


[View source]
def bind(*, tls : Nil = nil, host = ::Socket::IPAddress::LOOPBACK, port = nil, reuse_port = false) #

Bind TCP to a host and port


[View source]
def bind(*, tls : Nil = nil, address : Socket::IPAddress, reuse_port = false) #

Bind TCP to a Socket::IPAddress


[View source]
def bind(*, tls = nil, address : Socket::UNIXAddress) #

Bind to a Socket::UnixAddress


[View source]
def bind(*, tls = nil, path) #

[View source]
def bind(*, config : Orion::Config) #

Bind using a config


[View source]
def call(*args, **options) #

[View source]
def call(*args, **options, &) #

[View source]
def handlers : Array(HTTP::Handler) #

[View source]
def listen(*, workers, **opts) #

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


[View source]
def listen(*args, prefix = self.class.name, **opts) #

Listen for clients


[View source]
def request_processor #

[View source]
def use(handler : HTTP::Handler) #

[View source]
def use(handler) #

[View source]
def visualize #

Visualize the route tree


[View source]